当前位置:网站首页>La redirection de l'applet Wechat ne déclenche pas onload
La redirection de l'applet Wechat ne déclenche pas onload
2022-07-05 06:26:00 【Heerey525】
La situation:
1、Deindex
Saut de page(wx.navigateTo
)Àadd
Page,Pour la première foisadd
PageonLoad
,Mais pour la deuxième fois,index
Saut de page(wx.navigateTo
)Àadd
Page,Ne pas entreradd
PageonLoad
;
2、Deadd
Saut de page(wx.redirectTo
)Àindex
Page,Pas d'entrée.index
PageonLoad
Raisons:
La première fois que vous entrez dans une page,Va entrer dans cette pageonLoad
,Mais sauter et sauter,En fait, le routage n'est pas détruit,La pile de routage existe déjà sur cette page,Donc mis en cache,Il n'y aura plus deonLoad
Solutions:
1、InonShow
Saisissez les paramètres de routage
onShow: function () {
// Obtient la pile de page de l'applet actuel
let pages = getCurrentPages();
// La page la plus indexée du tableau--Page actuelle
let currentPage = pages[pages.length-1];
// Imprimer la page courante options
console.log(currentPage.options)
}
2、switchTab
Desuccess
AjouteronLoad
Méthodes
wx.switchTab({
url: '../index/index',
success: function(e) {
var page = getCurrentPages().pop();
if (page == undefined || page == null) return;
page.onLoad();
}
})
Références:
Cadre d'applet /Niveau logique /Routage des pages
Utilisation des applets wx.navigateTo Aller à la page ,Dans la pageonloadNe pas exécuter?
Applet Wechat switchTab Nouvelle page après le saut onload Problèmes non déclenchés
边栏推荐
- MySQL advanced part 1: triggers
- Paper reading report
- 求组合数 AcWing 887. 求组合数 III
- Client use of Argo CD installation
- Knapsack problem acwing 9 Group knapsack problem
- 安装OpenCV--conda建立虚拟环境并在jupyter中添加此环境的kernel
- [2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields
- Leetcode-6109: number of people who know secrets
- SQL三种连接:内连接、外连接、交叉连接
- Niu Mei's math problems
猜你喜欢
博弈论 AcWing 892. 台阶-Nim游戏
MySQL advanced part 2: storage engine
Leetcode stack related
[QT] QT multithreading development qthread
5.Oracle-錶空間
求组合数 AcWing 888. 求组合数 IV
高斯消元 AcWing 884. 高斯消元解异或線性方程組
How to make water ripple effect? This wave of water ripple effect pulls full of retro feeling
MPLS experiment
3.Oracle-控制文件的管理
随机推荐
Redis-01.初识Redis
Series of how MySQL works (VIII) 14 figures explain the atomicity of MySQL transactions and the principle of undo logging
AE tutorial - path growth animation
5. Oracle tablespace
MySQL advanced part 2: MySQL architecture
Usage scenarios of golang context
Find the combination number acwing 888 Find the combination number IV
在新线程中使用Handler
Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter
P3265 [jloi2015] equipment purchase
[moviepy] unable to find a solution for exe
Relevant information of National Natural Science Foundation of China
容斥原理 AcWing 890. 能被整除的数
11-gorm-v2-03-basic query
MySQL advanced part 1: stored procedures and functions
Leetcode stack related
June 29, 2022 daily
Nested method, calculation attribute is not applicable, use methods
[leetcode] day94 reshape matrix
Idea debug failed