关于antd vue 中table的customCell用法
antd vue
需求是table的单元格单击时,弹出弹窗
比如,单击测试时,弹出一个弹窗
序号 | 编码 | 名称 |
---|---|---|
1 | 001 | 测试 |
customCell
script部分
...
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '编码',
align: "center",
dataIndex: 'bm'
},
{
title: '名称',
align: "center",
dataIndex: 'name',
customCell: this.render //此处添加方法
},
],
然后去methods里,定义这样一个方法
render(record) {
return {
style: {
'color': 'blue', //这里将名称变了下色
},
on: {
click: () => { //点击事件,也可以加其他事件
this.$refs.mymodal.add(record);
}
}
}
},
可根据自己的需求进行调整