若A属性为空,则取B属性,否则取A属性:
<el-table :data="tableData" width="100%" :border="true">
<el-table-column prop="buyerNameAdapteParentheses" label="购方名称" >
<template slot-scope="scope">
<div v-if="scope.row.buyerNameAdapteParentheses" >{{scope.row.buyerNameAdapteParentheses}}</div>
<div v-if="!scope.row.buyerNameAdapteParentheses" >{{scope.row.buyerName}}</div>
</template>
</el-table-column>
</el-table>
<el-table-column prop="stime" label="状态">
<template slot-scope="scope">{{ scope.row.reportStatus | formatStatus }}</template>
</el-table-column>
filters: {
formatStatus (val) {
return val == 0 ? '生产中' : val == 1 ? '完成' : '未知';
}
}