Answer the question
In order to leave comments, you need to log in
How to track descending/ascending sort state in vue js?
Please tell me how to properly track the sort state, i.e. with each subsequent click on th, the data was sorted in reverse order, the code:
<tempate>
<table>
...
<th @click="sorted({ sortedBy: 'id', type: 'integer'}, $event)">Id</th>
<th @click="sorted({ sortedBy: 'title', type: 'string'}, $event)">title</th>
<th @click="sorted({ sortedBy: 'name', type: 'string'}, $event)">name</th>
...
</table>
</tempate>
<script>
...
data: {
list: [
{id, title, name},
...
]
},
methods: {
sorted({sortedBy, type}, e) {
}
}
...
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question