fastadmin 根据字段值控制开关按钮显示与隐藏,修改js文件,直接上代码:
{
field: 'is_active',
title: __('Is_active'),
searchList: {"0":__('Is_active 0'),"1":__('Is_active 1')},
formatter:function (value, row, index) {
if (row.type != 2) {
// 当行数据对应的type字段不等于2时,才显示开关按钮
return Table.api.formatter.toggle.call(this,value,row,index);
}
},
},