How does the WeChat applet call a method in a loop? The following article will introduce to you a method to implement loop calls in WeChat applet. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Implementing a cyclic call to a method in the WeChat applet
If you want to call a method cyclically, you must judge a certain value. This method is called when the value is false. If it is true, it will not be called.
query:function(){ if(!!wx.getStorageSync('userInfo')){ let _this=this; setTimeout(()=> { _this.query(); },500); return; } }
This is a loop calling a method. It can be equipped with a flag to control the maximum number of loops, or write a method after the if. Do it after the loop ends.
Recommendation: " Mini Program Development Tutorial"
The above is the detailed content of How does a WeChat applet call a method in a loop?. For more information, please follow other related articles on the PHP Chinese website!