Skip to content
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

onBeforeRouteLeave is not called with named views #614

Closed
ste-xx opened this issue Nov 23, 2020 · 1 comment · Fixed by #616
Closed

onBeforeRouteLeave is not called with named views #614

ste-xx opened this issue Nov 23, 2020 · 1 comment · Fixed by #616
Labels
bug Something isn't working

Comments

@ste-xx
Copy link

ste-xx commented Nov 23, 2020

Version

4.0.0-rc.5

Reproduction link

https://github.com/ste-xx/vue-router-example

Steps to reproduce

Create View with two router-views.
One is named (e.g. toolbar), one is default.

The named view, used a shared component (e.g toolbar.vue).

The default view used different components. (e.g, home, home2)

Add onBeforeRouteLeave to the default view components.

E.g:

Add onBeforeRouteLeave to home.

Add onBeforeRouteLeave to home2.

What is expected?

onBeforeRouteLeave will always triggered if the route changes

What is actually happening?

onBeforeRouteLeave will not always triggered if the route changes.

@ste-xx
Copy link
Author

ste-xx commented Nov 23, 2020

Workaround:
wrap onBeforeRouteLeave in a onMounted.

@posva posva added the bug Something isn't working label Nov 23, 2020
posva added a commit that referenced this issue Nov 24, 2020
posva added a commit that referenced this issue Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants