I have implemented a layout for my admin pages that displays user information in a consistent format, eliminating the need to fetch this data every time the page reloads.
However, I am facing an issue where the page does not wait for the layout to fully load before querying user information.
myLayout.vue
beforeMount() {
// retrieving user info from the server using Vuex action
}
myPage.vue
layout: "myLayout"
...
mounted() {
// fetching user info from the Vuex store
}
In this scenario, I anticipate beforeMount
to be executed first in myLayout.vue
,
but myPage.vue
proceeds and triggers mounted
before the Vuex action completes.
As a result, the lifecycle follows:
layout's beforeMount
-> page's beforeMount
-> page's mounted
-> layout's mounted
due to the page not waiting for the layout's beforeMount to be finished.
Is there a way to delay the mounting of a page until after the layout has been completely loaded?