<tr>
<th v-for="key in columns"
@click="sortBy(key)"
- :class="{ active: sortKey == key }">
+ :class="{ active: state.sortKey == key }">
{{ capitalize(key) }}
- <span class="arrow" :class="sortOrders[key] > 0 ? 'asc' : 'dsc'">
+ <span class="arrow" :class="state.sortOrders[key] > 0 ? 'asc' : 'dsc'">
</span>
</th>
</tr>
</script>
<!-- DemoGrid component script -->
<script>
-const { reactive, computed } = Vue
+const { reactive, computed, toRefs } = Vue
const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1)
}
return {
- ...state,
+ state,
filteredData,
sortBy,
capitalize