跳转路由的方式
1.this.$router.push("网址")访问会多一条浏览记录。
2.this.$router.replace({path:"/home"})
注意:replace跟push很像,但不会向 history 添加新记录,而是替换当前的history记录
3.this.$router.go(n):跳转到浏览记录的目前路由的记录的前(/后)n位的网址
n可以为正值,也可以为负值,正值:代表前进n步的浏览记录,负值:代表返回n步的浏览记录。
注意:
// 在浏览器记录中前进一步,等同于 history.forward()
this.$router.go(1)
// 后退一步记录,等同于 history.back()
this.$router.go(-1)