1、把@change事件改成使用before-change
2、before-change它的描述是switch状态改变前的钩子,返回false或者返回Promise且被reject则
停止切换api中使用类型是boolean/function,function 对应写成 ()=>Promise<boolean>
:before-change="()=>checkState(item)"
let isInit = true
function handleStatusChange(row) {
if (isInit) {
isInit = false
return
}
let text = row.status === "0" ? t('enable') : t('disable');
proxy.$modal.confirm(t('confirm_to') + text + '""' + row.userName + t('user_id')).then(function () {
return changeUserStatus(row.userId, row.status);
}).then(() => {
proxy.$modal.msgSuccess(text + t('success'));
}).catch(function () {
row.status = row.status === "0" ? "1" : "0";
});
};