您的位置:首页 > Web前端

页面跳转的几种方法

2018-03-15 17:25 218 查看

页面跳转的几种方法

window.location

window.location.href=url;

window.location.assign(url) //当前页面跳转,会存到历史列表中

window.location.replace(‘url’) //当前页面跳转,不会存到历史列表中

window.open() //新开页面,有些浏览器会拦截

也可以用vue-router this.$router.push(url)

window.history 回退前进

window.history.go(-1)

window.history.back()

window.history.go(1)

window.history.forward()

刷新页面

window.reload()

window.location.href = window.location.href
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  js 前端 window