main.js文件添加以下代码后,进入页面后隐藏,再重新显示时,页面其实是被重载了的,请问这个是BUG吗?
// #ifdef H5
Vue.mixin({
onReady() {
// 修改当前url
if (!!(window.history && history.pushState)) {
if (window.location.href.indexOf('?') != -1 && window.location.href.indexOf('uid') == -1) {
history.replaceState(null, null, window.location.href.split('#')[0] + '&uid='+ uni.getStorageSync('user_info').uid)
}
if (window.location.href.indexOf('?') == -1 && window.location.href.indexOf('uid') == -1) {
history.replaceState(null, null, window.location.href.split('#')[0] + '?uid='+ uni.getStorageSync('user_info').uid)
}
}
}
});
// #endif
如果想在H5端修改所有的当前页面url除了这种混入的方法外还有其他方法吗?
2 个回复
3***@qq.com (作者)
有人吗?
3***@qq.com (作者)
有人吗?
m***@foxmail.com
用路由重定向不就行了,不会路由?
2020-11-04 11:46