[Vuejs]-Vue route change but page info shows previous route details

0👍

I am feeling a little lack of more details from your implementation.

From what you show and explain, I guess the component, that you have your beforeMount hook in, is being re-used on route change. Components that are being re-used don’t get mounted again. You need to use the router’s navigation guards or even in-component navigation guards to trigger your data updates instead. You can find the specifics of the router’s navigation flow here.

If my suspicion is right, I recommend that you consider using dedicated route components (one per route). You could call them e.g. PageHome, PageFoo, PageBar. In addition there’s the option of nested routes.

These patterns make an app’s structure and navigational behaviour much more clear.

Leave a comment