我试图在调用函数时更改路由器:
register() {
if (this.password === this.confirmPass) {
this.submit = true
this.active = true
this.errorMessage = ''
this.$emit('user-added', userName)
;('some code here to change the route')
} else {
this.errorMessage = 'password does not match!'
}
}
最佳答案
如果您使用的是 vue-router,您可以像这样更改路由 this.$router.push('/some-route')
或使用您的路由名称 this.$router.push({ name: 'nameOfRoute' })
关于javascript - 更改路由器路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57454360/