当前位置:网站首页>小程序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',
})
}
})
边栏推荐
- 有哪些可以投稿软件工程/系统软件/程序设计语言类外文期刊、会议?
- EN 12467纤维水泥平板产品—CE认证
- Software protection scenario of NOR FLASH flash memory chip ID application
- 2. 依赖管理和自动配置
- EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monocular Object Pose Est...
- YOLOv5的Tricks | 【Trick12】YOLOv5使用的数据增强方法汇总
- 两个链表的第一个公共节点——LeetCode
- input输入框超出部分用省略号表示以及判断内容是否有超出(PC端)
- 详解JDBC的实现与优化(万字详解)
- 软件测试证书(1)—— 软件评测师
猜你喜欢
How to easily obtain the citation format of references?
如何破坏Excel文件,让其显示文件已损坏方法
Introduction to Qt (6) - Implementation of the lottery system
Is there a way out in the testing industry if it is purely business testing?
2. 依赖管理和自动配置
SQL注入基础---order by \ limit \ 宽字节注入
12. 处理 JSON
I caught a 10-year-old Ali test developer, and after talking about it, I made a lot of money...
13. Content Negotiation
编程语言为什么有变量类型这个概念?
随机推荐
Cache knowledge summary
【openpyxl】只读模式、只写模式
ArcGIS Pro 创建tpk
Which foreign language journals and conferences can be submitted for software engineering/system software/programming language?
"NIO Cup" 2022 Nioke Summer Multi-School Training Camp 2 DGHJKL Problem Solution
Dump file generation, content, and analysis
【爬虫】scrapy创建运行爬虫、解析页面(嵌套url)、自定义中间件(设置UserAgent和代理IP)、自定义管道(保存到mysql)
SQL注入基础---order by \ limit \ 宽字节注入
leetcode 前K个高频单词
15. Interceptor - HandlerInterceptor
Dump文件生成,内容,以及分析
13. Content Negotiation
两个链表的第一个公共节点——LeetCode
① 数据库介绍 及 关系型数据库的关系代数表达式
[C language] binary search (half search)
LENS CRA和SENSOR CRA匹配问题解析
Mysql.慢Sql
16. File upload
SAS data processing technology (1)
HGAME 2022 Week1 writeup