当前位置:网站首页>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
边栏推荐
- 高斯消元 AcWing 884. 高斯消元解异或线性方程组
- Find the combination number acwing 887 Find combination number III
- LeetCode-61
- Idea debug failed
- MySQL advanced part 1: stored procedures and functions
- TypeScript 基础讲解
- Simple selection sort of selection sort
- 高斯消元 AcWing 884. 高斯消元解异或線性方程組
- AE tutorial - path growth animation
- 1.14 - assembly line
猜你喜欢

求组合数 AcWing 887. 求组合数 III

International Open Source firmware Foundation (osff) organization

MySQL advanced part 1: stored procedures and functions

MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理

LeetCode 0108. Convert an ordered array into a binary search tree - the median of the array is the root, and the left and right of the median are the left and right subtrees respectively

博弈论 AcWing 892. 台阶-Nim游戏

5. Oracle tablespace

Redis-01.初识Redis

LeetCode-54

1.手动创建Oracle数据库
随机推荐
Knapsack problem acwing 9 Group knapsack problem
[2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
Leetcode dynamic programming
安装OpenCV--conda建立虚拟环境并在jupyter中添加此环境的kernel
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
ADG5412FBRUZ-RL7应用 双电源模拟开关和多路复用器IC
Alibaba established the enterprise digital intelligence service company "Lingyang" to focus on enterprise digital growth
MySQL advanced part 2: MySQL architecture
Operator priority, one catch, no doubt
LeetCode 0107. Sequence traversal of binary tree II - another method
时间很快,请多做有意义的事情
Traversal of leetcode tree
NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar
如何正确在CSDN问答进行提问
Paper reading report
4. 对象映射 - Mapping.Mapster
Leetcode-31: next spread
[leetcode] day95 effective Sudoku & matrix zeroing
Applicable to Net free barcode API [off] - free barcode API for NET [closed]
Usage scenarios of golang context