当前位置:网站首页>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
边栏推荐
猜你喜欢
php字符串的截取方式
php - the first of three solid foundations
ETL(二):表达式组件的使用
软件成分分析:手握5大能力守护软件供应链安全
OpenFeign设置header的3种方式
How to better assess credit risk?Just watch this scorecard model live
np.nan, np.isnan, None, pd.isnull, pd.isna finishing and summary
How to use the database like tap water?|Tencent Cloud Database TDSQL-C
国产 GPU 创业潮 喧嚣下的资本游戏
Openlayers 快速上手教程
随机推荐
工厂方法模式
SQL Server2019安装步骤及脱机安装Microsoft机器学习组件下一步不能继续的问题
SQL Server 2014 installation tutorial (nanny-level graphic tutorial)
自定义mvc框架复习
js炫酷仪表盘插件
Basic protocol explanation
软件成分分析:手握5大能力守护软件供应链安全
ETL(二):表达式组件的使用
Seata分布式事务
PGSQL database to realize the import and export
GCC版本升级到指定版本
sql concat() function
如何更好评估信用贷风险?看这场评分卡模型直播就可以了
国产 GPU 创业潮 喧嚣下的资本游戏
Manual architecture, Mysql interview 126 questions
[b01lers2020]Welcome to Earth-1
LeetCode_377_组合总和Ⅳ
Scala基础语法入门(三)Scala中的各种运算符
FreeRTOS实验--一个函数创建多个任务
路由-Tab切换页面