-
-
Notifications
You must be signed in to change notification settings - Fork 5k
How could next(path) act like a replace rather than push #897
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
Comments
Hmm.. could be useful. Maybe a second parameter for next? |
@hiyuki Why do you need a replace rather than a push? Can you tell us a bit about your use case, please? |
I use it as a conditional redirect and doesn't allow user to go back |
I use this in beforeEach. When I click the back button at the first time, it won't do anything. I need to click twice. I had to replace next with router.replace after #795 fixed. |
This is exactly the same problem I'm having. I'm glad this issue is here because I was hunting around for an option to pass to And yes, $router.go(-1) needs to be called twice (or back button pressed twice) after a redirect. Replace seems to be necessary in this case. |
@fnlctrl Aborting the navigation doesn't remove it from history? |
No.. there's no browser API to remove anything from history. Therefore,
every navigation is made directly, and aborting a transition will make
vue-router replace the current history with the previous one.
…On Sat, Nov 26, 2016 at 11:14 PM Eduardo San Martin Morote < ***@***.***> wrote:
@fnlctrl <https://github.com/fnlctrl> Aborting the navigation doesn't
remove it from history?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#897 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFTLl3QQzMcfnohUL2xs3BNTEW6AgylKks5rCEzmgaJpZM4KvlvM>
.
|
Now I achieve it by next(false),router.replace(path).
But I hope I can add some option to indicate next() to make a replace jump.
Thank you.
The text was updated successfully, but these errors were encountered: