el-table根据table数据设置某行样式

使用VUE,ELement UI组件中的el-table组件,想要根据从后台拿到的数据改变行样式,效果如下:

 HTML代码如下:

<template>
  <el-table
    :data="log"
    style="width: 100%;">
    <el-table-column
      prop="time"
      label="时间"
      width="180">
      <template slot-scope="scope">
        <div :class="scope.row.status? 'success':'fail'">{{scope.row.time}}</div>
      </template>
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名">
      <template slot-scope="scope">
        <div :class="scope.row.status? 'success':'fail'">{{scope.row.name}}</div>
      </template>
    </el-table-column>
    <el-table-column
      prop="status"
      label="状态">
      <template slot-scope="scope">
        <div :class="scope.row.status? 'success':'fail'">{{scope.row.status}}</div>
      </template>
    </el-table-column>
  </el-table>
</template>

<style lang="stylus" scoped>
  .success
    color:''
  .fail
    color:red
</style>

即对每一个table项进行判断,达到改变整行样式的效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值