- i18n文件中定義page.js文件
// zh-CN文件夾
Self_created: '自建'
// en文件夾
Self_created: 'Self created'
- store中定義dict.js文件
state: {
carSourceSelectList: [] // 車輛來源
},
mutations: {
REFRESH_DICT (state) {
state.carSourceSelectList = [
{ value: '1', label: 'MES' },
{ value: '0', label: i18n.t('page.Self_created') }
]
}
}
- layOut中使用該mapMutations,每次進入系統(tǒng)或刷新頁面實時獲取當前語言枚舉值
import { mapMutations } from 'vuex'
mounted () {
this.refresh_DICT()
},
methods: {
...mapMutations([ 'REFRESH_DICT' ]),
refresh_DICT () {
this.REFRESH_DICT()
}
}