当前位置:网站首页>Applets: lifecycle
Applets: lifecycle
2022-07-28 06:54:00 【Like Feynman%】
1. What is life cycle
Life cycle refers to the creation of an object from --》 function --》--》 The whole stage of destruction , The emphasis is on a time period
We can Startup of wechat applet , Express The beginning of the life cycle
Close the applet , Indicates the end of the life cycle
The process of running an intermediate applet , Is the life cycle of the applet
2. Classification of life cycle
In the applet , The life cycle is divided into two categories , Namely :
- Application life cycle
- Page lifecycle
The life cycle range of the page is relatively small , The application life cycle is relatively large 
2. What is a life cycle function
Life cycle function : It refers to the built-in functions provided by the applet framework , With the life cycle , Automatically execute in order
The function of life cycle function : Allow programmers to at a specific point in time , Perform certain operations . for example : When the page is just loaded , Can be in onLoad Initialize the data of the page in the life cycle function
Be careful : Life cycle emphasizes time period , The life cycle function emphasizes the point in time
2.1 Classification of life cycle functions
- Apply lifecycle functions
- It refers to that the applet is starting --》 function --》 Those functions called in turn during destruction
- stay app.js In a statement
//app.js file App({ // When the applet is initialized , Execute this function , The trigger of the overall situation is in turn , Can do some initialization work onLaunch:function(options){}, // Applet startup , Or trigger when you cut into the foreground display from the background onShow:function(options){}, // Applet startup , Or trigger when you switch from the foreground to the background display onHide:function(){}, })
- Page lifecycle function
- On page .js The document states
Page({ // Monitor page loading , A page is called only once onLaunch:function(options){}, // Monitor page display onShow:function(){}, // Listen for the first rendering of the page , A page is called only once onReady:function(){}, // Small monitoring page hidden onHide:function(){}, // Monitor page uninstall , A page is called only once onUnload:function(){}, })
边栏推荐
- Source code analysis of countdownlatch of AQS
- NFS 共享存储服务
- Technology sharing | sending requests using curl
- Question brushing record - linked list
- Hdu-5783 divide the sequence (greedy water question)
- MySQL主从
- MySQL common commands
- 软件测试的生命周期(流程)
- Implementation of simple address book in [c language]
- [C language] custom structure type
猜你喜欢

MySQL主从

What kind of air conduction Bluetooth headset with good configuration is recommended

NAT和PAT的原理及配置

单元测试框架Jest搭配TypeScript的安装与配置

网络——传输层(详细版)

思寒漫谈测试人职业发展

技术分享 | 接口测试常用代理工具

How to describe a bug and the definition and life cycle of bug level

Dynamic memory management function of C language

File operation in C language
随机推荐
手把手教你三步完成测试监控系统搭建
Ubuntu18.04+centos7 configure redis master-slave [learning notes]
What's a good gift for Tanabata? Niche and advanced product gift recommendation
Prometheus monitoring Nacos
[the beginning of self redemption]
测试面试题集锦(五)| 自动化测试与性能测试篇(附答案)
NFS shared storage service
Insertion and deletion of nodes in linked list
Ubuntu18.04搭建redis集群【学习笔记】
Ubuntu18.04+Centos7配置redis主从【学习笔记】
MySQL主主
Analysis of the semaphore source code of AQS
Pku-2739-sum of constructive prime numbers
VMware Workstation 配置net模式
软件开发中常见模型
Optimization ideas from ordinary query commodities to highly concurrent query commodities
HDU-2036-改革春风吹满地(多边形面积模板)
NFS 共享存储服务
软件测试的生命周期(流程)
Vmware workstation configuration net mode