elementUI 表格 table 动态生成列,列过滤

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/jinjiankang/article/details/98514098

若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 ? '完成' : '未知';
  }
}

猜你喜欢

转载自blog.csdn.net/jinjiankang/article/details/98514098
今日推荐