当前位置:网站首页>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
边栏推荐
- Niu Mei's math problems
- 11-gorm-v2-02-create data
- [moviepy] unable to find a solution for exe
- MQClientException: No route info of this topic: type_ topic
- 4. Oracle redo log file management
- 阿里巴巴成立企业数智服务公司“瓴羊”,聚焦企业数字化增长
- WordPress switches the page, and the domain name changes back to the IP address
- [2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
- TCP's understanding of three handshakes and four waves
- Leetcode-9: palindromes
猜你喜欢
MySQL advanced part 1: index
Game theory acwing 891 Nim games
Bit of MySQL_ OR、BIT_ Count function
3. Oracle control file management
阿里新成员「瓴羊」正式亮相,由阿里副总裁朋新宇带队,集结多个核心部门技术团队
【LeetCode】Easy | 20. Valid parentheses
P2575 master fight
Client use of Argo CD installation
Gauss Cancellation acwing 884. Solution d'un système d'équations Xor linéaires par élimination gaussienne
博弈论 AcWing 894. 拆分-Nim游戏
随机推荐
5. Oracle TABLESPACE
4. Object mapping Mapster
20220213-CTF MISC-a_ good_ Idea (use of stegsolve tool) -2017_ Dating_ in_ Singapore
Dataframe (1): introduction and creation of dataframe
NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar
MySQL advanced part 1: triggers
阿里新成员「瓴羊」正式亮相,由阿里副总裁朋新宇带队,集结多个核心部门技术团队
MySQL advanced part 1: stored procedures and functions
Client use of Argo CD installation
2022/6/29-日报
Chart. JS - Format Y axis - chart js - Formatting Y axis
Leetcode-6108: decrypt messages
Chapter 6 relational database theory
2048项目实现
FFmpeg build下载(包含old version)
Regulations for network security events of vocational group in 2022 Guizhou Vocational College skill competition
2048 project realization
Record the process of configuring nccl and horovod in these two days (original)
[leetcode] day95 effective Sudoku & matrix zeroing
JS quickly converts JSON data into URL parameters