Skip to content

Commit 3269f14

Browse files
author
Vinayak Kulkarni
committed
Changed it to use vue-router
1 parent abeafe5 commit 3269f14

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module.exports = {
22

33
template: '<div>\
4-
<a v-show="sorttype === \'asc\'" @click="sortData(data)">\
5-
{{ label }} <i class="down black icon" :class="icon" v-if="sort === 1"></i>\
6-
</a>\
7-
<a v-show="sorttype === \'desc\'" @click="sortData(data)">\
8-
{{ label }} <i class="up black icon" :class="icon" v-if="sort === 1"></i>\
9-
</a>\
4+
<router-link v-if="data.sorttype === \'desc\'" :to="{ name: routeName, query: { sort: data.sort, sorttype: data.sorttype }}" @click.native="sortData(data.sort, data.sorttype)">\
5+
{{ label }} <i class="chevron down black icon" v-if="data.sort"></i>\
6+
</router-link>\
7+
<router-link v-if="data.sorttype === \'asc\'" :to="{ name: routeName, query: { sort: data.sort, sorttype: data.sorttype }}" @click.native="sortData(data.sort, data.sorttype)">\
8+
{{ label }} <i class="chevron up black icon" v-if="data.sort"></i>\
9+
</router-link>\
1010
</div>',
1111

1212
props: {
@@ -20,6 +20,10 @@ module.exports = {
2020
default: 'chevron',
2121
required: false
2222
},
23+
routeName: {
24+
type: String,
25+
required: true
26+
},
2327
data: {
2428
type: Object,
2529
default: function() {

0 commit comments

Comments
 (0)