perf: vxe

This commit is contained in:
xingyu4j
2022-11-12 15:52:43 +08:00
parent 94527ae9ae
commit 725cc4e41b
9 changed files with 304 additions and 299 deletions

View File

@ -1,6 +1,7 @@
import { App, unref } from 'vue'
import 'xe-utils'
import XEUtils from 'xe-utils'
import './renderer'
import { i18n } from '@/plugins/vueI18n'
import zhCN from 'vxe-table/es/locale/lang/zh-CN'
import enUS from 'vxe-table/lib/locale/lang/en-US'
@ -138,6 +139,10 @@ VXETable.formats.mixin({
formatDate({ cellValue }, format) {
return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss')
},
// 格式字典
formatDict() {
return 'cellValue 123'
},
// 四舍五入金额每隔3位逗号分隔默认2位数
formatAmount({ cellValue }, digits = 2) {
return XEUtils.commafy(Number(cellValue), { digits })

View File

@ -0,0 +1,12 @@
import { DictTag } from '@/components/DictTag'
import { VXETable } from 'vxe-table'
// 创建一个简单的超链接渲染
VXETable.renderer.add('XDict', {
// 默认显示模板
renderDefault(renderOpts, params) {
const { row, column } = params
const { content } = renderOpts
return <DictTag type={content as unknown as string} value={row[column.field]}></DictTag>
}
})

View File

@ -0,0 +1 @@
import './dict'