orderBy table
This commit is contained in:
@@ -4,7 +4,10 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th v-for="(c, i) in columns" :key="i">{{ c.heading }}</th>
|
||||
<th v-for="(c, i) in columns" :key="i">
|
||||
<span @click="orderBy(c.orderBy)" v-if="c.orderBy">{{ c.heading }} V</span>
|
||||
<span v-else>{{ c.heading }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody is="transition-group" name="list">
|
||||
@@ -40,6 +43,15 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
orderBy(col) {
|
||||
console.log(col);
|
||||
this.$emit('sort', {
|
||||
orderBy: col,
|
||||
orderDesc: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user