1

我正在尝试研究如何根据单元格中的文本(例如“绿色”)呈现具有特定背景颜色的单元格。

使用模板( https://github.com/matfish2/vue-tables-2#templates )似乎可以做到这一点,但我没有遵循如何在单页 vue 应用程序中使用 props.index 来呈现特定的单元格特定的颜色。

<v-client-table :data="entries" :columns="['id', 'name' ,'age', 'edit']">
      <a slot="edit" slot-scope="props" class="fa fa-edit" :href="edit(props.row.id)"></a>
</v-client-table>
#Note: You can get the index of the current row relative to the entire data set using props.index

有任何想法吗?

4

1 回答 1

3

对于那些需要对整行应用一些类的人:

options: {
  rowClassCallback: function(row) { return 'bg-warning'}, //Using Boostrap4
}

编辑: 我认为文档已更新。

cellClasses:{
  balance: [
    {
        class:'low-balance',
        condition: row => row.balance < 100
    }
  ]
}
于 2019-09-07T21:10:46.237 回答