天天看點

背景管理(element)表格插槽用法和計算屬性

1.在表格内使用插槽(在插槽裡面可以處理)

<el-table-column label="排序" align="center">
    <template slot-scope="scope">
       {{scope.row.bannerStatus=='1'?'确定':'未确定'}}
    </template>>
 </el-table-column>
           

2.在表格内運用計算屬性

<el-table-column label="狀态" align="center">
    <template slot-scope="scope">
        <span>{{ computedStatus(scope.row.approvalStatus) }}</span>
    </template>
 </el-table-column>







computed: {
  computedStatus() {
    return function (id) {
      let str = "";
        if (id == 0) {
          str = "需稽核";
        }
        if (id == 1) {
          str = "已認證";
        }
        if (id == 2) {
          str = "已拒絕";
        }
        if (id == 3) {
          str = "已上報";
        }
        return str;
      };
    },
  },
           

繼續閱讀