使用方式
找到需要添加插槽的列,例如我想给性别这一列添加插槽,当text=0的时候显示男,当text=1的时候显示女,否则就显示未知
这是原代码
{
title: '性别',
align: 'center',
dataIndex: 'sex',
},
·把下面的这段代码添加进去
customRender: function (text) {
return text == 0 ? '男' : text == 1 ? '女' : '未知'
},
完整的代码如下
{
title: '性别',
align: 'center',
dataIndex: 'sex',
},
customRender: function (text) {
return text == 0 ? '男' : text == 1 ? '女' : '未知'
},
这是基本的使用方式,后期会分享一些复杂的实现方式!