调用方法如下
<el-table-column prop="auditTypeId" label="稽核类型">
<template slot-scope="scope">
{{ getjhtype(scope.row.auditTypeId) }}
</template>
</el-table-column>
方法如下
// 获取稽核类型-因为存在不同数据库
getjhtype(type) {
for(let i = 0;i<this.Options.length;i++){
if (type == this.Options[i].dictCode) {
return this.Options[i].d;
}
}
// this.Options.forEach((item) => {
// if (type == item.dictCode) {
// return 123;
// }
// });
},
如同上面的代码,使用forEach时,返回值没办法显示出来,使用for循环可以正确显示。大概是因为forEach return时不会停止,有了解原理的敬请发言