iview table 在语言切换时,表格的列名不会跟着变化,是不是BUG?
表格代码
<Table :columns="tabColumns" :data="myAppTabData"></Table>
表格列
tabColumns: [
{
title : this.$t("global.list.no") ,
width : '80' ,
render : (h, params) => {
return h('span', params.index+1);
}
},
{
title: this.$t("app.appName"),
key: 'code',
width : '150'
},
{
title: this.$t("app.appCode"),
key: 'name'
},
{
title: this.$t("global.list.createdBy"),
key: 'createdBy',
width : '150'
},
{
title: this.$t("global.list.createdAt"),
key: 'createdDate',
width : '200'
},
语言切换
methods : {
getLanguageText : function (lang) {
if(lang == "zh-CN"){
return "中文";
}else if(lang == "en-US"){
return "English";
}else if(lang == "ja-JP"){
return "日本語";
}
},
changeLanguage : function(data){
this.currentLanguage = this.getLanguageText(data);
Vue.config.lang = data;
window.localStorage.setItem('language', data)
}
}
将tabColumns放置到computed中