Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Wechat APP life cycle and page life cycle?

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "what is the life cycle of Wechat APP and what is the life cycle of the page?" in the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The startup process of Mini Program

Let's draw a picture to show the whole Mini Program startup process, and we will know:

App lifecycle

To execute the App () function is to register an App

1 when registering for app, you can judge the entry scene of Mini Program.

2 We can make some data requests through the life cycle function.

3 you can set a global object in app so that all pages can use it.

Life cycle Page of the page (initial data of the page * / data: {}, / * Life cycle function-listening page load * / onLoad: function (options) {console.log ("onload")}, / * Life cycle function-listening page display * / onShow: function () {console.log ("onshow")} / * Lifecycle function-first rendering of listening page completed * / onReady: function () {console.log ("onReady")}, / * Lifecycle function-listening page hiding * / onHide: function () {console.log ("onHide")} / * Lifecycle function-- unload the listening page * / onUnload: function () {console.log ("onUnload")}, / / listen for the user drop-down action OnPullDownRefresh: function () {/ / if you want to use this, you must use "enablePullDownRefresh": true console.log ("pull down")}, / / the handler function onReachBottom:function () {console.log ("pull up to the bottom")}, / / the handler function of the page scroll trigger event onPageScroll: function (e) {console.log ("the wheel is understanding", e)})

1 send a network request in the lifecycle function to obtain data from the server

2 initialize some data in data to facilitate wxml reference

3 listen for wxml events and bind corresponding event functions

4 there are page scrolling, pull-up, pull-down, etc.

The life cycle of the page (figure)

This is the end of the content of "what is the life cycle of Wechat APP and the life cycle of the page". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report