微信分享ios兼容
修复微信HTML5 History兼容性问题
遇到问题: ios的微信中,初次进入页面后分享不生效,但是刷新之后分享是生效的
解决方案: 在分享页面中加入以下代码
beforeRouteEnter(to, from, next) {
// 修复iOS版微信HTML5 History兼容性问题
if (to.path !== location.pathname) {
// 此处不可使用location.replace
location.assign(to.fullPath)
} else {
next()
}
}
原因:微信IOS版中,切换路由时SPA项目的url不会变