- 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,每次进入系统或刷新页面实时获取当前语言枚举值
import { mapMutations } from 'vuex'
mounted () {
this.refresh_DICT()
},
methods: {
...mapMutations([ 'REFRESH_DICT' ]),
refresh_DICT () {
this.REFRESH_DICT()
}
}
网友评论