-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vue 编程式导航 #12
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在 Vue 中,除了
<router-link>
标签,还提供了一种使用 JS 代码实现导航的方法,称为编程式导航,router.push
Ps:如果提供了 path,params 会被忽略,如:
router.push({ path: 'register', params: {id:1}})
router.replace(location, onComplete?, onAbort?)
跟
router.push
很像,唯一的不同就是,它不会向 history 添加新记录,而是跟它的方法名一样 —— 替换掉当前的 history 记录。router.go(n)
这个方法的参数是一个整数,意思是在 history 记录中向前或者后退多少步,类似
window.history.go(n)
。The text was updated successfully, but these errors were encountered: