iview表格通过render自定义改变字体颜色
<Table :columns="columns" :data="dataSource" border :loading="loading"></Table>
export default {
data() {
return {
columns: [
{
title: '姓名', key: '', align: 'center', render: (h, params) => {
return h('div',[
h('span', {
style: {
color: '#f00'
}
}, params.name),
]);
}
},
],
loading: false,
}
}
}
根据状态改变颜色:
style: {color: params.name = 'a' ?'#0f0':'#f00'}