Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

componentDidNotFound 没有监听到 #3732

Closed
listar opened this issue Jul 9, 2019 · 4 comments
Closed

componentDidNotFound 没有监听到 #3732

listar opened this issue Jul 9, 2019 · 4 comments

Comments

@listar
Copy link

listar commented Jul 9, 2019

app.js 写入
componentDidNotFound(res){ console.log('onPageNotFound', res); }

使用
Taro.navigateTo({ url: “url” });

监听不到

并且这个报错
image

componentDidCatchError 监听不到

@taro-bot
Copy link

taro-bot bot commented Jul 9, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Garfield550
Copy link
Collaborator

刚才的回复有问题,已经删除了。

微信小程序的 App 生命周期有 onPageNotFound(Object object),但是我的测试是 wx.navigateTo 到不存在的页面时捕捉不到错误。

image

@Garfield550
Copy link
Collaborator

使用自定义编译模式跳转的页面是可以在 App 生命周期里抓到错误的,也许你可以试一下 Taro 是否支持这种方式,wx.navigateTofail 回调,建议 navigate 相关的路由逻辑在这里处理。

image

@listar listar closed this as completed Jul 9, 2019
@listar
Copy link
Author

listar commented Jul 9, 2019

使用自定义编译模式跳转的页面是可以在 App 生命周期里抓到错误的,也许你可以试一下 Taro 是否支持这种方式,wx.navigateTofail 回调,建议 navigate 相关的路由逻辑在这里处理。

image

谢谢! 因为老的项目跳转路径,有很多后端返回的路径, 改版里面路径全换了,想一劳永逸!
想一步搞定是我想多了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants