sorting - vuesax表格组件数据如何默认降序排序?
问题描述
我正在尝试默认按降序对我的 vuesax 表组件数据进行排序并显示。但是默认情况下它是升序的,当点击表格中的标题 Id 时,它会在 vuesax 中的 sort-key 属性的帮助下以降序排序。任何人都可以帮我将其默认更改为降序。我的脚本在 Vue.Js 中
我的 Vuesax 表格组件代码
<template slot="thead">
<vs-th sort-key="id">Id</vs-th>
<vs-th sort-key="first_name">Name</vs-th>
</template>
<template slot-scope="{data}">
<tbody>
<vs-tr :data="tr" :key="indextr" v-for="(tr, indextr) in data">
<vs-td>
<p class="product-name font-medium truncate">{{ tr.id }}</p>
</vs-td>
</vs-tr>
</tbody>
</template>
解决方案
我想你会在这里找到答案:https ://eslint.vuejs.org/rules/sort-keys.html 。
在你的 main.js 文件中,你应该已经导入了 Vuesax。如果没有,您可以执行以下操作并添加相关选项(来自上面的链接):
import Vuesax from 'vuesax'
import 'vuesax/dist/vuesax.css'
Vue.use(Vuesax, {
// options here
})
推荐阅读
- r - ntile 函数在最新版本的 R 中不起作用
- python - Airflow XCom - 如何使用 TriggerDagRunOperator 在 DAG 之间共享变量?
- wordpress - 插件嵌入任何文档不向用户显示
- maven - 使用“mvn clean install”命令构建 eclipse che 项目时出现问题
- ios - iOS 中最小部署目标支持的构建大小不同
- javascript - HTML2canvas 屏幕截图不呈现完整的 div,只显示屏幕上可见的内容?
- node.js - 无法窥探原始值;在nestJS中给出未定义
- menu - Medium.com 菜单水平样式 - 参见图片示例
- hibernate - 喜欢 2 列的查询
- ios - 如何从 CVPixelBuffer 创建 CGImage?