当前位置:网站首页>The uniapp/applet onload method executes the interpretation every time the page is opened
The uniapp/applet onload method executes the interpretation every time the page is opened
2022-08-02 13:01:00 【Harbin Luohong Technology Co., Ltd.】
I recently made a program and found that my onload method was executed every time the page was loaded. After trying to find the problem for two or three days, I finally found the mystery.
Whether onload is executed depends on whether your page is unloaded or hidden. Only the unloaded page will execute onload, because unloading means the end of the life cycle of the page, and the next time you enter, it will enter a new life cycle
So when is it considered uninstall and when is it considered hidden?
For example, page A is the home page of the program. I enter page B from page A. At this time, both pages A and B have life cycles. When B returns to A, then the life cycle of B is over.Entering page B from A is equivalent to re-opening the life cycle of B, so every time I open B from A, onload will be executed, then I enter page C from B again, and then I return to B from C, then C has life.At the end of the cycle, the page of B is displayed. At this time, the onload of B will not be executed, then if I open C again, the onload of C will be executed.
In summary, if my page is opened, onload will be executed every time, and if the page is returned, onload will not be executed
I hope this analysis can help you understand the usage scenarios of onload
边栏推荐
- How to better assess credit risk?Just watch this scorecard model live
- How to implement waterfall flow layout (what is waterfall flow layout)
- js炫酷仪表盘插件
- wx-wow(微信小程序动效库)
- 微信小程序getPhoneNumber接口code=40013
- scrapy框架初识1
- FreeRTOS实验--删除任务
- PHP伪协议详解
- Set proxy server (Google+IE) "Recommended Collection"
- Manual architecture, Mysql interview 126 questions
猜你喜欢
随机推荐
分享一个Chrome控制台数据获取的例子
FreeRTOS experiment--one function creates multiple tasks
Good shooting js game source code
A powerful js pop-up alert plugin
RestTemplate 使用:设置请求头、请求体
Hand rolled architecture, 41 Redis interview asked
Introduction to Graph Neural Networks (GNN) "Recommended Collection"
第48篇-timestamp2参数分析【2022-08-01】
MFC入门教程(深入浅出MFC)
图论之Floyd,多源图最短路如何暴力美学?
OpenFeign设置header的3种方式
Object.entries()
js semi-circle loading progress animation js special effects
uniapp/小程序 onload方法每次打开页面都执行解读
selenium chrome driver运行时的cannot determine loading status from target frame detached问题
pytorch model to tensorflow model
How to better assess credit risk?Just watch this scorecard model live
svg气球升起爆炸js特效
FreeRTOS中名称规范
RESTful 风格(详细介绍 + 案例实现)