0๐
I would do it using data attributes.
First, add $event
param to sort
method. this would be the event object for the click event.
<AqTableHeader @click="sort('name',$event)" text="Name" />
in AqTableHeader, add a data attributes for isAsc
<template>
<th :class="{small: checkbox}" v-on="$listeners" :data-is-asc="isAsc">
<!-- ... -->
</th>
</template>
and in sort
method, get isAsc
using the event parameter
sort(type,$event) {
const isAsc = $event.target.dataset.isAsc;
// ... other logic
}
๐คJacob Goh
- [Vuejs]-Struggling to show then hide success alert using Vue
- [Vuejs]-VueJS 2 โ Update modal component when passing in data
Source:stackexchange.com