save() { //方法名
let showAlertOnly = false;//设置变量
this.formData.forEach(v=>{
if(v.def&&v.defvalue==''){
showAlertOnly = true;//满足这个if拦截条件变量为true
...继续执行if里的操作
return //return掉
}
})
if (showAlertOnly) {//在上面的循环得出变量是true还是false,true就满足拦截条件就不执行下面的步骤,如果是false就跳过return执行下面的步骤
return; // Exit the function if showAlertOnly is true
}
...被拦截与否之后要执行的步骤
}
控制方法流,满足条件再往下走,设置开关
最新推荐文章于 2024-06-18 12:29:21 发布