当前位置:网站首页>The route of wechat applet jumps again without triggering onload
The route of wechat applet jumps again without triggering onload
2022-07-05 06:26:00 【Heerey525】
situation :
1、 from index Page Jump (wx.navigateTo) To add page , The first time will enter add page onLoad, But the second time from index Page Jump (wx.navigateTo) To add page , Will not enter add Page onLoad;
2、 from add Page Jump (wx.redirectTo) To index page , Will not enter the index page onLoad
reason :
When you first enter a page , Will enter the page onLoad, But jump around , In fact, the route is not destroyed , The page already has a routing stack , So it's cached , Will not enter again onLoad
resolvent :
1、 stay onShow Enter to get the routing parameters
onShow: function () {
// Get the page stack of the current applet
let pages = getCurrentPages();
// The page with the largest index in the array -- Current page
let currentPage = pages[pages.length-1];
// Print out... In the current page options
console.log(currentPage.options)
}
2、switchTab Of success Add in callback onLoad Method
wx.switchTab({
url: '../index/index',
success: function(e) {
var page = getCurrentPages().pop();
if (page == undefined || page == null) return;
page.onLoad();
}
})
Reference material :
Applet framework / Logic layer / Page routing
Applet usage wx.navigateTo Jump to the page , On the page onload Don't execute ?
Wechat applet switchTab New page after jump onload Problems that don't trigger
边栏推荐
- New title of module a of "PanYun Cup" secondary vocational network security skills competition
- 栈 AcWing 3302. 表达式求值
- JS quickly converts JSON data into URL parameters
- MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理
- Suppose a bank's ATM machine, which allows users to deposit and withdraw money. Now there is 200 yuan in an account, and both user a and user B have the right to deposit and withdraw money from this a
- 阿里新成员「瓴羊」正式亮相,由阿里副总裁朋新宇带队,集结多个核心部门技术团队
- Bash exercise 17 writing scripts to install the server side of FRP reverse proxy software
- Leetcode array operation
- Simple selection sort of selection sort
- Find the combination number acwing 887 Find combination number III
猜你喜欢

博弈论 AcWing 894. 拆分-Nim游戏

LeetCode 0107. Sequence traversal of binary tree II - another method

20220213-CTF MISC-a_ good_ Idea (use of stegsolve tool) -2017_ Dating_ in_ Singapore

MySQL advanced part 1: View

MySQL advanced part 2: MySQL architecture

Stack acwing 3302 Expression evaluation

2.Oracle-数据文件的添加及管理

阿里巴巴成立企业数智服务公司“瓴羊”,聚焦企业数字化增长

阿里新成员「瓴羊」正式亮相,由阿里副总裁朋新宇带队,集结多个核心部门技术团队

中国剩余定理 AcWing 204. 表达整数的奇怪方式
随机推荐
[2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields
Golang uses context gracefully
5. Oracle tablespace
4. Oracle redo log file management
容斥原理 AcWing 890. 能被整除的数
Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter
Quickly use Amazon memorydb and build your own redis memory database
Bit of MySQL_ OR、BIT_ Count function
[moviepy] unable to find a solution for exe
博弈论 AcWing 893. 集合-Nim游戏
1.15 - input and output system
Find the combination number acwing 887 Find combination number III
June 29, 2022 daily
Records of some tools 2022
There are three kinds of SQL connections: internal connection, external connection and cross connection
Inclusion exclusion principle acwing 890 Divisible number
MySQL advanced part 2: the use of indexes
3. Oracle control file management
Winter vacation water test 1 Summary
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian