项目场景:
<el-table-colum :label="$t('lang.data_w_system')"' width="130">
<template slot-scope="scope">
{{scope.row.is_system?'是':'否'}}
</template>
</el-table-column>
上面是原来的代码,现在我需要把label定义的内容放在data的一个变量里,然后我就试着按照以下的写法操作了
tableHeaderData:[
{ label: $t('lang.data_w_system'), prop: "native_name" },
],
结果出现报错
解决方案:多加this
tableHeaderData:[
{ label: this.$t('lang.data_w_system'), prop: "native_name" },
],