feat: 为组件STable的标题加上多国语言功能

pull/150/head
gosk 2023-08-04 18:32:03 +09:00 committed by 小诺
parent 8db2dab751
commit 064a7bc127
1 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,9 @@
import draggable from 'vuedraggable-es' import draggable from 'vuedraggable-es'
import columnSetting from './columnSetting.vue' import columnSetting from './columnSetting.vue'
import './index.less' import './index.less'
import i18n from '@/locales'
const {t} = i18n.global
export default { export default {
name: 'STable', name: 'STable',
@ -155,7 +158,13 @@
false false
this.needTotalList = this.initTotalList(this.columns) this.needTotalList = this.initTotalList(this.columns)
this.loadData() this.loadData()
this.columnsSetting = this.columns this.columnsSetting = this.columns.map(c => {
const tt = c.title
if (typeof tt === "string") {
c.title = () => t(tt)
}
return c
})
}, },
methods: { methods: {
/** /**