后台返回的数组
const operDetails = [{code:'01',name:'外购'},{code:'01',name:'自制'},{code:'01',name:'接受投资'}]
<el-table-column slot="buy_way" label="购买方式">
<template slot-scope="scope">
<span>{{ getLabel(operDetails, scope.row.buy_way, "code", "name") }}</span>
</template>
</el-table-column>
// 根据后台返回的code 数字显示label
getLabel(list, id, value, label) {
if (id != "" && Array.isArray(list) && list.length != 0) {
return !list.find((item) => item[value] == id) ? id : list.find((item) => item[value] == id)[label];
} else {
return id;
}
},