-
Notifications
You must be signed in to change notification settings - Fork 161
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
H5版路由守卫未能和window.location同步 #52
Comments
这个问题 其实可以这样解决 在H5上 使用通配符 |
@SilurianYang 文字描述清楚达义太难了:-) 然额通配符*分支,在其他页面都精确配置路由的情况下,由于不占优先级,*分支走不到吧?求出手更准确的代码:-) |
@minkuan 那你可以把通配符的代码移植到 |
@minkuan 你可以加群讨论或者完善 uni-simple-router 群号:769241495 |
router.beforeEach((to, from, next) => { // #ifdef H5 // #ifndef H5 @SilurianYang 因H5在微信中手工刷新2次后即可复制链接/在浏览器中打开成功,以上代码尝试做2次路由。以上处理为嘛无效呢?此前在目标页mounted中尝试window.location.replace(xxx)则uni-simple-router将陷入无限刷新 |
卧槽,搞定~ |
哦!伙计 看起来你成功啦! 恭喜你 ! 我很希望你能贡献你的源码 放置文档 |
没问题,你这项目及文档做的还不错。你说下格式要求,分享互助更多人 |
以.md结尾的文件即可,包括标题及正文。请发布到我的邮箱📬 我会在文档首页上说明出处。感谢你的支持! |
简单记个文档,没看到你邮箱。。btw 留下你邮箱地址吧,我发你邮箱 |
遇到同样的问题,微信刷新死循环。您能发一份完整的文档吗? 我在官方文档教程没找到,非常感谢! |
@jpgaus 这是楼主提供的解决方案 我上传上来 希望帮助更多需要的人 |
Describe the bug
由于微信的BUG,SPA/HISTOR/H5在微信浏览器“复制链接”/“在浏览器中打开“,链接错误。解决办法:https://www.cnblogs.com/wisewrong/p/9689897.html
但uni-simple-router的路由守卫beforeEach/afterEach在生命周期中的时机似不正确,window.location.replace()或window.location.href=xxx所作的URL变更,未能同步到uni-simple-router组件的Router/Route中,导致该解决办法陷入无限刷新;因而uni-simple-router组件无法绕过微信浏览器BUG,不能在微信浏览器中使用。
The text was updated successfully, but these errors were encountered: