在ios微信浏览器中,vue+vue-router的项目无论点击哪个页面跳转到其他路由,选择复制链接或是用safari打开都是第一次访问的页面。之前的issues提到可以每次进入url用jssdk重新获取签名,实践发现:
1.ios每次访问变化的url,用该url调wx.config报错:invalid signature。
2.只在页面首次打开config一次也并不能解决。
3.每次打开变化的url,用第一次打开的url去调wx.config不会报签名无效的错误,但是复制链接依然是第一次打开的url。
Hello, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue - thank you!
@inmWang 您好,您解决了吗?我也遇到同样的问题了
@SeongBrave 在需要复制链接的页面刷新url,微信只会缓存第一次进入的url
@ 我试过了,如果用router-link的话没问题,但是用编程式的导航的话就会有问题,我估计还是vue-router的问题,你可以 https://didi.github.io/cube-ui/example/#/ 就没问题的,因为他用的是 router-link
@SeongBrave 我发现我用router-link的也是不行的,在ios端都不行,最后用reload解决
@SeongBrave 哦对了我用的是history模式
@inmWang 您好,您是怎么刷新的吗?
@SeongBrave 在需要复制链接的页面,调用document.location.reload()
@inmWang 多谢了
@974929538 请在页面的哪里调用 document.location.reload(), vue的钩子里吗?
复制链接打开地址永远是落地页解决办法 已解决 文章中reload方法在需要的地方执行
可以再需要分享和浏览器打开的页面进行replace操作
let _href = window.location.href
if (_href.indexOf('&replace=1') <= -1) {
window.location.replace(_href+'&replace=1'
}
在页面加载的时候加上这步操作即可解决ios上述问题
Most helpful comment
可以再需要分享和浏览器打开的页面进行replace操作
let _href = window.location.href
if (_href.indexOf('&replace=1') <= -1) {
window.location.replace(_href+'&replace=1'
}
在页面加载的时候加上这步操作即可解决ios上述问题