当前位置:网站首页>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
边栏推荐
- MPLS experiment
- Idea debug failed
- Golang uses context gracefully
- Operator priority, one catch, no doubt
- How to make water ripple effect? This wave of water ripple effect pulls full of retro feeling
- Game theory acwing 891 Nim games
- 时间很快,请多做有意义的事情
- SQL三种连接:内连接、外连接、交叉连接
- Leetcode-6110: number of incremental paths in the grid graph
- Paper reading report
猜你喜欢

Game theory acwing 892 Steps Nim game

求组合数 AcWing 888. 求组合数 IV

博弈论 AcWing 893. 集合-Nim游戏

5.Oracle-表空间

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

20220213-CTF MISC-a_ good_ Idea (use of stegsolve tool) -2017_ Dating_ in_ Singapore
![[2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis](/img/20/826cc9d514496955a557439881234d.jpg)
[2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis

TCP's understanding of three handshakes and four waves

Leetcode-6110: number of incremental paths in the grid graph

MySQL advanced part 1: stored procedures and functions
随机推荐
Series of how MySQL works (VIII) 14 figures explain the atomicity of MySQL transactions and the principle of undo logging
Chart. JS - Format Y axis - chart js - Formatting Y axis
1.手动创建Oracle数据库
ollvm编译出现的问题纪录
How to generate an image from text on fly at runtime
Modnet matting model reproduction
Leetcode-31: next spread
MySQL advanced part 1: stored procedures and functions
our solution
Leetcode-556: the next larger element III
NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar
1.13 - RISC/CISC
Sum of three terms (construction)
Chinese remainder theorem acwing 204 Strange way of expressing integers
Winter messenger 2
June 29, 2022 daily
Leetcode stack related
7.Oracle-表结构
Records of some tools 2022
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