search
HomeWeChat AppletMini Program DevelopmentHow does a WeChat applet call a method in a loop?

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.

How does a WeChat applet call a method in a loop?

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!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Atom editor mac version download

Atom editor mac version download

The most popular open source editor