看了官方文档的用法,customRow好用,customCell怎么都不好用,后来找了好久,才找到解决办法。
直接看例子。
<a-table
:columns="renderColumns(columns)"
:data-source="tableData"
>
</a-table>
methods: {
renderColumns(columns) {
const _this = this
return columns.map(item => {
return {
...item,
customCell(record, index) {
return {
click: (event) => {},
dblclick: (event) => {},
contextmenu: (event) => {},
mouseenter: (event) => {},
mouseleave: (event) => {}
}
}
}
})
}
}