AI助手支持GPT4.0
怎样点击按键跳出循环?How to click the button to jump out of the loop?
怎样点击按键跳出循环?
Click the stop button, the start button can not get the m value, resulting in the loop can not jump out, is there a better way? 1、 index.js Page({bindinput: function (e) { this.setData ({ userName: e. detail.value }) },start: function () { var m= this.data .m console.log ('m------//',m) for (var i = 0; i < 6; ++i) { console.log ('bhtime------//', i) if (i==5){var i=0} this.setData ({ userName: i }) if(m==5) break;} }, stop: function () { console.log ('stop') this.setData ({ m: 5 }) }, })2、 index.wxmlclass= "button1" catchtap="start">start class="button2" catchtap="stop">stop class="c">class="check-box" maxlength='10' value="{{userName}}" type="text" bindinput='bindinput' >
把循环封装,点击按键调用封装你的循环进行中断