orderBy table

This commit is contained in:
Sebastian Frank
2017-08-25 13:00:32 +02:00
parent cd7a727f0f
commit d59aa8cf0d
3 changed files with 53 additions and 10 deletions

View File

@@ -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>