AI助手支持GPT4.0
求教一个函数嵌套中断的问题? 第二个函数我是想当成公共函数来调用Ask for advice on the problem of function nesting interrupt? I want to call the second function as a public function
求教一个函数嵌套中断的问题? 第二个函数我是想当成公共函数来调用
第二个函数我是想当成公共函数来调用
第二个函数为 判断第一个函数输入的值为空,
在第一个函数中调用第二个判断的函数,如何在第二个函数判断第一个函数输入为空时中断并不再执行第一个函数里剩下的代码
submitChangeFun:function(e){ console.log(e.detail.value.change); let t = this; let changeData = e.detail.value.change; t.publicPopup(changeData); console.log('判断不为空时再继续执行'); }, publicPopup:function(inputData){ if(inputData==""){ wx.showToast({ title: '请输入后再点击', icon:'none' }) return false; } }
The second function I want to call the second function as a common function is to judge the value entered by the first function is empty. In the first function, I call the second judgement function, and how to interrupt the second function when judging the first function is empty, and stop the remaining code in the first function. submit ChangeFun:function (e){ console.log (e. detail.value.change ); let t = this; / / enter the value let changedata = E detail.value.change ; / / call the function t.publicpopup (changedata) to judge whether the input value is empty; / / continue the execution if it is not empty console.log ('continue to execute if it is not empty ');}, / / judge whether the input value is an empty function PU blicPopup:function (inputData){ if(inputData==""){ wx.showToast ({Title: 'please input and click', icon:'none' }) return false; } }
第二个函数判断后return一个true或false,这样第一个函数就知道是不是可以return了