- 使用
this.$router.go(0)
可以刷新当前页面; - 使用
this.$router.replace()
可以替换当前页面; - 使用
this.$router.push()
可以跳转到新页面; - 使用
this.$router.push({path: '/xxx', query: {a: 1}})
可以跳转到新页面,并传递参数; - 使用
this.$router.push({name: 'xxx', params: {a: 1}})
可以跳转到新页面,并传递参数; - 使用
this.$router.push({path: '/xxx', query: {a: 1}, replace: true})
可以替换当前页面,并传递参数; - 使用
this.$router.push({name: 'xxx', params: {a: 1}, replace: true})
可以替换当前页面,并传递参数; - 使用
this.$router.go(-1)
可以返回上一页; - 使用
this.$router.go(1)
可以前进一页; - 使用
this.$router.go(-2)
可以返回上两页; - 使用
this.$router.go(2)
可以前进两页; - 使用
this.$router.go(-n)
可以返回上n页; - 使用
this.$router.go(n)
可以前进n页;