-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
replace option is missing when use beforeEach hook #1090
Comments
It's added in 2.1.0 https://github.com/vuejs/vue-router/releases/tag/v2.1.0
|
You are not get it, I do not know the navigation which invoke beforeEach hook is push or replace |
Yes, there's currently no information about whether beforeEach was invoked by push/replace. |
I need every route contain the same query info, but do not want to copy it in every navigation, in beforeEach hook, just add it if not provided, so i need the next(path) in the hook keep the same behavior |
In this case where you want to enforce query params, simply call router.beforeEach((to, from, next) => {
next()
next({
query: {
foo: 'bar'
},
replace: true
});
}); |
I need the same help. Please open this. |
+1 for this feature. I want to hook the router in each page in ddtalk app, to add parameter dd_nav_bgcolor, but I found all the links in next are set as router.push...
|
+1 |
1 similar comment
+1 |
The same question!
|
+1 |
the query: Object.assign({}, to.query, { r: Math.random() })
// or
query: { ...to.query, r: Math.random() } Closing to prevent noise from questions |
The route object doesnot contain any replace imformation, so if i call
router.replace()
or enable replace in<view-link replace>
, then use next(path) always invokehistory.push
The text was updated successfully, but these errors were encountered: