-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
请给小程序也加上路由变更的事件通知 #7903
Comments
这个需求我前阵子做统计pv的时候也遇到过,因为taro把wx生命周期覆盖了,只能是劫持wx.navigateTo之类关于路由变化的方法实现。不知道官方有没想实现这种需求的计划,我可以贡献一下代码。 |
可以使用wx.onAppRoute做一个监听 |
其实这个换个思路就好啦: 需求:父(index)向子(detailed)跳转。detailed 加载完毕后收到 index 发来的数据。 正常思路: 现在思路(反过来):
示例: detailed: |
可以像这里说的那样直接使用 |
这个特性解决了什么问题?
小程序目前没法得知路由的变化事件
这个 API 长什么样?
eventCenter.on('__taroRouterChange', onRouteChange);
The text was updated successfully, but these errors were encountered: