Home  >  Article  >  WeChat Applet  >  Does the mini program have an immediate execution function?

Does the mini program have an immediate execution function?

angryTom
angryTomOriginal
2020-03-20 17:35:023655browse

Does the mini program have an immediate execution function?

Does the mini program have an immediate execution function?

The mini program is developed using JavaScript language, so you can use an immediate execution function and place it in onLoad It can be done in the life cycle. For example,

onLoad:function(){
    (function () {
        console.log('小程序拥有立即执行函数');
    }());
}

It is recommended to define a function and then call it in onLoad so that the code can be reused.

onLoad:function(){
    this.de()
},
de:function(){
    ...........
}

Recommended learning: Small program development

The above is the detailed content of Does the mini program have an immediate execution function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn