vue-router icon indicating copy to clipboard operation
vue-router copied to clipboard

add the replace attribute in location for hooking in beforeEach

Open wanyaxing opened this issue 6 years ago • 12 comments

Closes https://github.com/vuejs/vue-router/issues/1620

wanyaxing avatar Nov 26 '17 12:11 wanyaxing

e... I should to study something about CircleCI now... to be continued.

wanyaxing avatar Nov 26 '17 13:11 wanyaxing

Hey, sorry for the delay. What are you trying to achieve? The issue you linked is closed. Why are you always setting replace to true if location is an object?

posva avatar Dec 06 '17 10:12 posva

If somebody reset the path in beforeEach, the new path will be open as push type, actually, it will be puzzled if the original router path is replace type.

In this PR, the replace setting of location in the $router.replace() will be set as true, so the developer can find the route's type in the beforeEach hooking.

image

wanyaxing avatar Dec 10 '17 02:12 wanyaxing

Aaah, is the issue you're referring to #1620?

posva avatar Dec 10 '17 12:12 posva

yes.

And the vue-router has supported the replace type checking in the route guards next() in this commit: https://github.com/vuejs/vue-router/commit/d53ec3c29a5f05fcb3753b20e12ac37e5546ece2

This pr is an expand of that commit.

wanyaxing avatar Dec 10 '17 13:12 wanyaxing

ok, could you add some tests to make sure the property is added in different scenarios but not others? (push/replace/calling it with next)

posva avatar Dec 10 '17 19:12 posva

I have added an example for this commit. Hopes to be useful.

wanyaxing avatar Dec 18 '17 12:12 wanyaxing

Is there any progress? I waiting for this PR to be merged for a long time.

luozhihua avatar May 02 '18 18:05 luozhihua

I am waiting for this PR to be merged too..

choegyumin avatar Jun 26 '18 05:06 choegyumin

This will probably come along with other changes that would allow knowing what kind of navigation happened (back, forward, push, replace)

posva avatar Jun 26 '18 08:06 posva

@posva is there any plan to add these features? we are waiting for this feature too too too too too long. almost a year.

hxlniada avatar Aug 04 '18 08:08 hxlniada

Around one year after the last post, I would like to ask if this branch will be merged some day.

reckert avatar Apr 08 '19 13:04 reckert