当前位置:网站首页>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
边栏推荐
猜你喜欢

FreeRTOS creation tasks - dynamic creation, static creation

Seata分布式事务

GCC版本升级到指定版本

js秒表倒计时插件

Distributed current limiting, hand & redisson implementation

FreeRTOS创建任务--动态创建、静态创建

动态组件-component

单例模式的七种写法,你都知道吗?

SQL Server2019安装步骤及脱机安装Microsoft机器学习组件下一步不能继续的问题

Manual architecture, Mysql interview 126 questions
随机推荐
package.json and package-lock.json
Do you know Dijkstra of graph theory?
scrapy框架初识1
Redis全部
你知道图论的spfa吗?
uniapp/小程序 onload方法每次打开页面都执行解读
如何关闭开启硬件加速[通俗易懂]
Data Lake (3): Hudi Concept Terminology
动态组件-component
Basic operations of openGauss database (super detailed)
Intelligent Image Analysis-Intelligent Home Appliance Image Target Detection Statistical Counting Detection and Recognition-iCREDIT
js stopwatch countdown plugin
js true 3d histogram plugin
Object.entries()
第48篇-timestamp2参数分析【2022-08-01】
TFRecord简介,原理分析,代码实现?[通俗易懂]
数据湖(三):Hudi概念术语
数据湖(二):什么是Hudi
#Summer Challenge#[FFH] OpenHarmony Device Development Foundation (3) Compilation Dependencies
3 ways for OpenFeign to set headers