小编V L*_*udi的帖子

在 vueJS 2 中带有分页但无法呈现的 element-ui 表行的背景颜色

我必须根据表中的结果列为 false 添加红色背景颜色,为 true 添加绿色背景,我使用 elementUI + 数据表分页 + vuejs。我尝试通过在结果列上使用样式绑定来添加列声明,提前致谢

我的模板代码

<template slot="header" slot-scope="table" :style = "customRowBackground(table.row)">
<template slot-scope="table">{{ table.row.launch_success }}</template>
</el-table-column>
Run Code Online (Sandbox Code Playgroud)

我的 customRowBackgrond() 函数

 customRowBackgrond({row}){     
      if (row.launch_success == true) {
        return {'backgrondColor': 'rgb(252, 230, 190)'};
      } 
      else if (row.launch_success == false) {
        return { backgrondColor: 'rgb(252, 230, 190)'};
      } 
      else {
        return {backgrondColor: 'rgb(252, 230, 190)'};
      }
    },
Run Code Online (Sandbox Code Playgroud)

我需要在我的整个表中获得绿色的真实值和红色的假值......提前致谢。

javascript vuejs2 element-ui

5
推荐指数
1
解决办法
7040
查看次数

标签 统计

element-ui ×1

javascript ×1

vuejs2 ×1