element-ui表格状态

模版

<el-table-column
                    prop="status"
                    label="干预状态"
                    width="150"
                >
                <template slot-scope="{row}">
                      <div :style="statusStyle(row.status)" class="statusBorder">
                          <span :class="statusClass(row.status)">
                              {{ getStatusName(row.status) }}
                          </span>
                      </div>
                 </template>
                    <!-- <template slot-scope="scope">
                        <el-tag
                            :type="scope.row.status === 100 ? 'warning' : scope.row.status === 200 ? 'success' :
                                scope.row.status === 300 ? 'info' : scope.row.status === 400 ? '' : 'danger'"
                            disable-transitions
                        >{{
                            scope.row.status === 100 ? '等待上线' : scope.row.status === 200 ? '上线成功' :
                                scope.row.status === 300 ? '已下线' : scope.row.status === 400 ? '已删除' : '上线失败'
                        }}</el-tag>
                    </template> -->
                    
                </el-table-column>

方法

        // statusClass(status) {
        //     if (status === '上线成功') {
        //         return 'status-good';
        //     }
        //     else if (status === '已下线') {
        //         return 'status-bad';
        //     }
        //     else if (status === '上线失败') {
        //         return 'status-warn';
        //     }
        //     else if (status === '待上线') {
        //         return 'status-info';
        //     }
        // },
        // statusStyle(status) {
        //     if (status === '上线成功') {
        //         return {backgroundColor: '#f0f9eb'};
        //     }
        //     else if (status === '已下线') {
        //         return {backgroundColor: '#fef0f0'};
        //     }
        //     else if (status === '上线失败') {
        //         return {backgroundColor: '#fff7e6'};
        //     }
        //     else if (status === '待上线') {
        //         return {backgroundColor: '#e6f7ff'};
        //     }
        // },

样式

.status-good {
    color: green;
    font-weight: bold;
}

.status-bad {
    color: red;
    font-weight: bold;
}

.status-warn {
    color: orange;
    font-weight: bold;
}

.status-info {
    color: blue;
    font-weight: bold;
}
 .statusBorder {
 border: 1px solid red;
 width: 20px;
 height: 10px;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值