0
点赞
收藏
分享

微信扫一扫

给el-table的某列设置样式

你带来了我的快乐 2022-03-11 阅读 164
<el-table :data="tableData" >
    <el-table-column
        v-for="item in column"
        :key="item"
        :prop="item.prop"
        :label="item.label"
        :width="item.width"
      >
        <template slot-scope="scope">
          <div v-if="scope.column.label == '修改字段'">
            <div style="color:#0090EC;cursor: pointer;">
             {{ scope.row[item.prop] }}
            </div>
          </div>
     
          <div
            v-if="
              scope.column.label != '修改字段'' 
            "
          >
            {{ scope.row[item.prop] }}
          </div>
        </template>
      </el-table-column>
    </el-table>
  column: [
    { label: "修改字段", prop: "sender", width: 300 },
    { label: "名字", prop: "name", width: 120 },
    { label: "年龄", prop: "age", width: 140 },
    { label: "地址", prop: "address", width: 140 },
  ],
举报

相关推荐

0 条评论