当前位置:网站首页>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
边栏推荐
- Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter
- 阿里巴巴成立企业数智服务公司“瓴羊”,聚焦企业数字化增长
- H5内嵌App适配暗黑模式
- JS quickly converts JSON data into URL parameters
- Leetcode backtracking method
- 区间问题 AcWing 906. 区间分组
- Presentation of attribute value of an item
- Leetcode dynamic programming
- 安装OpenCV--conda建立虚拟环境并在jupyter中添加此环境的kernel
- MySQL advanced part 1: stored procedures and functions
猜你喜欢

Find the combination number acwing 889 01 sequence meeting conditions

NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar

Design specification for mobile folding screen

Gaussian elimination acwing 884 Gauss elimination for solving XOR linear equations

Interval problem acwing 906 Interval grouping

5. Oracle TABLESPACE

栈 AcWing 3302. 表达式求值

2021apmcm post game Summary - edge detection

AE tutorial - path growth animation
![[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian](/img/f1/e7a8a1a31bc5712d9f32d91305a2b0.jpg)
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
随机推荐
What is socket? Basic introduction to socket
P2575 master fight
求组合数 AcWing 889. 满足条件的01序列
Game theory acwing 894 Split Nim game
MySQL advanced part 1: stored procedures and functions
阿里巴巴成立企业数智服务公司“瓴羊”,聚焦企业数字化增长
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
Dataframe (1): introduction and creation of dataframe
International Open Source firmware Foundation (osff) organization
什么是套接字?Socket基本介绍
将webApp或者H5页面打包成App
Leetcode recursion
What's wrong with this paragraph that doesn't work? (unresolved)
Simple selection sort of selection sort
C job interview - casting and comparing - C job interview - casting and comparing
Bash exercise 17 writing scripts to install the server side of FRP reverse proxy software
Modnet matting model reproduction
高斯消元 AcWing 884. 高斯消元解异或线性方程组
1.14 - assembly line
1.15 - input and output system