页面跳转的几种方法
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