Skip to content

BeforeRouteEnter() happens after mounted() after upgrade. #2239

Discussion options

You must be logged in to vote

Are the beforeRouteEnter and mounted in the same component?

Is the logging done immediately, at the top of the hook, or do you have some asynchronous code that might be delaying the logging?

I've adjusted the example from the Vue Router docs to use those two hooks:

beforeRouteEnter definitely runs before mounted.

As mentioned in the docs:

The beforeRouteEnter guard does NOT have access to this, because the guard is called before the navigation is confirmed, thus the new entering component has not even been created yet.

If it hasn't been created then it definitely hasn't been mounted.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@steven-twerdochlib
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants