根据文档,按需引入,配置sortable排序不生效问题
官方示例如下
import XEUtils from 'xe-utils'
import {VXETable, Header, Column, Colgroup, Table } from 'vxe-table'
import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
VXETable.setup({
i18n: (key, args) => XEUtils.toFormatString(XEUtils.get(zhCN, key), args),
})
Vue.use(Header)
Vue.use(Column)
Vue.use(Colgroup)
Vue.use(Table)
解决
按需引入Icon,就会展示排序的箭头了
import {..., Icon } from 'vxe-table'
Vue.use(Icon)
其他问题记录:
vxeTable 下的vxe-column 元素,如果封装成组件,则列的顺序会反向,不知道为什么
MyColumn.vue
<template>
<vxe-column field="1" title="1"/>
<vxe-column field="2" title="2"/>
</template>
index.vue
<template>
<vxe-table>
<myColumn />
</vxe-table>
</template>
这样第一列title是2