Skip to content

Commit 3bf9aad

Browse files
author
Vinayak Kulkarni
committed
💫 Plugin
1 parent e975566 commit 3bf9aad

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
3+
template: '<a v-show="sorttype === \'asc\'" @click="sortData(data)">\
4+
{{ label }} <i class="down black icon" :class="icon" v-if="sort === 1"></i>\
5+
</a>\
6+
<a v-show="sorttype === \'desc\'" @click="sortData(data)">\
7+
{{ label }} <i class="up black icon" :class="icon" v-if="sort === 1"></i>\
8+
</a>',
9+
10+
props: {
11+
label: {
12+
type: String,
13+
default: 'Sort Me',
14+
required: false
15+
},
16+
icon: {
17+
type: String,
18+
default: 'chevron',
19+
required: false
20+
},
21+
data: {
22+
type: Object,
23+
default: function() {
24+
return {
25+
sort: null,
26+
sorttype: null,
27+
}
28+
},
29+
required: true
30+
}
31+
},
32+
methods: {
33+
sortData(sort, direction) {
34+
this.$emit('sort-data', sort, direction);
35+
},
36+
}
37+
}

0 commit comments

Comments
 (0)