render函数动态修改样式
— 根据数据变化动态修改类名以实现样式更改
代码如下(示例):
render: (h, { row, index }) => {
let edit = [
h("InputNumber", {
props: {
value: row.amount,
placeholder: "请输入",
},
on: {
input: (val) => {
this.tableData[index].amount = val;
row.amount = val;
},
},
}),
];
return h(
"div",
{ class: row.amount <= 0 ? "red_number_input" : "" },
[edit]
);
},
/deep/.red_number_input {
.ivu-input-number-input {
color: red !important;
}
}