layui.formSelects.data('catalog', 'local', {
arr: optionData,
keyName: 'name',
keyVal: 'value',
});
/**
* id: 点击select的id
* vals: 当前select已选中的值
* val: 当前select点击的值
* isAdd: 当前操作选中or取消
* isDisabled: 当前选项是否是disabled
*/
formSelects.on('catalog', function (id, vals, val, isAdd, isDisabled) {
if (isAdd){
...
}else {
return false; // 取消本次操作
}
})
formSelects.value('catalog', [optionData[key].value])
formSelects.render('catalog');