需求描述

H5页面中为了引导用户从老版的H5页面地址中进入新版的H5页面地址。当用户登录后直接跳转到新的地址。

解决问题

​ 1.当前页面打开新页面

1
2
3
4
5
self.location.href="https://blog.csdn.net/weixin_49175501"

location.href="https://blog.csdn.net/weixin_49175501"

window.location.href="https://blog.csdn.net/weixin_49175501l"

​ 2.在父页面打开新页面

1
parent.location.href="https://blog.csdn.net/weixin_49175501" 

​ 3. 在顶层页面打开新页面

1
top.location.href="https://blog.csdn.net/weixin_49175501" 

​ 4. 跳转可以传递参数

1
window.location.href=`https://blog.csdn.net/weixin_49175501?value=${e}` 

​ 5. 接收参数

1
2
3
4
5
6
7
<script>
export default{
onload(option){
console.log(option.value);
}
}
</script>