使用fastadmin 框架开发,如果有对字段的特殊处理,然后再调用原formatter 方法时会丢失this 对象
场景判断某行不显示该值,
{
field: 'status',
title: __('Status'),
yes: 2,
no: 1,
searchList: {1: '不显示', 2: '显示'},
custom: {1: 'default', 2: 'success'},
formatter: function (value, row, index) {
if (row.state) {
return Table.api.formatter.toggle.call(this, value, row, index);
} else {
return '-';
}
},
},可以调用javascript 的call 方法将当前对象传入
call()方法解释描述
