当前位置:网站首页>小程序onPageNotFound的坑
小程序onPageNotFound的坑
2022-08-11 00:10:00 【小任睡不醒`】
App.onPageNotFound和wx.onPageNotFound用来监听小程序要打开的页面不存在事件。
这里有一个坑就是,如果在小程序里面使用wx.navigateTo等路由Api进行页面跳转,如果页面不存在只会报错,并不会触发onPageNotFound。
onPageNotFound有一个使用场景就是,当扫码登录的页面不存在时可以重定向到另一个存在的页面。
App({
onPageNotFound(res){
wx.redirectTo({
url: 'pages/index/index',
})
}
})边栏推荐
- Timers, synchronous and asynchronous APIs, file system modules, file streams
- 15. Interceptor - HandlerInterceptor
- C language, operators of shift operators (> >, < <) explanation
- "NIO Cup" 2022 Nioke Summer Multi-School Training Camp 4 ADHK Problem Solving
- 百战RHCE(第四十八战:运维工程师必会技-Ansible学习3-构建Ansible清单)
- YOLOv5的Tricks | 【Trick11】在线模型训练可视化工具wandb(Weights & Biases)
- Which translation software is more accurate [Free]
- Call activity of Activiti7 sub-process
- 【pypdf2】合并PDF、旋转、缩放、裁剪、加密解密、添加水印
- 9. Rest style request processing
猜你喜欢
随机推荐
[C language] binary search (half search)
C language, operators of shift operators (> >, < <) explanation
The Missing Semester of Your CS Education
Promote the high-quality development of denim clothing
SQL injection base
"NIO Cup" 2022 Nioke Summer Multi-School Training Camp 2 DGHJKL Problem Solution
Dump文件生成,内容,以及分析
[21-day learning challenge - kernel notes] (5) - devmem read and write register debugging
12. Handling JSON
力扣每日一题-第52天-387. 字符串中的第一个唯一字符
【openpyxl】过滤和排序
地下管廊可视化管理系统搭建
HGAME 2022 Final Pokemon v2 writeup
91.(cesium之家)cesium火箭发射模拟
[C language] Implementation of guessing number game
Mysql.慢Sql
Design and Realization of Employment Management System in Colleges and Universities
Timers, synchronous and asynchronous APIs, file system modules, file streams
分布式.性能优化
Mysql. Slow Sql









