用row-class-name給el-table設(shè)置行樣式,數(shù)據(jù)更新后行樣式渲染混亂,是不是需要用Vue.nextTick()在回調(diào)中更新,如果是,動態(tài)樣式:row-class-name="tableRowClassName"如何在回調(diào)中更新?<el-table :data="tableList" :row-class-name="tableRowClassName">...</el-table><script>
tableRowClassName({row, rowIndex}) { if (row.type === 2) { return 'success-row';
} return '';
},
getList(){
axios.post('/getList', { uid: this.uid
})
.then(function (response) { console.log(response); this.tableList = response.data.dataList
})
.catch(function (error) { console.log(error);
});
}</script>
1 回答

慕妹3146593
TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超9個贊
直接 :row-class-name="row.type === 2 ? 'success-row' : ''" 試試
添加回答
舉報
0/150
提交
取消