There is a dynamic data in navigation in vue, but the navigation component needs to request the interface of navigation only when it is entered for the first time to find a solution.

I now use hopping routing to perform a listening refresh in the navigation component, and this status can now be changed
watch: {

in authentication.
"$route" (to, from) {
  location.reload()
}

}
but every page you enter will be refreshed again, and the effect is not very good. Is there any other solution?

Mar.12,2021

what does the navigation component mean to enter for the first time? Isn't navigation always there?
it is recommended that you make a small piece of authentication information into a component v-if to call the interface in the hook function, so that the request for the hook function will be repeated every time from hiding to display, which ensures that the information is up-to-date every time the user looks at it.


it is recommended to use the routing guard of vue. official data portal

< hr >

there is a question, why not deal with it directly in the mounted lifecycle hook function of your component for the first time, instead of messing with routing?


like a user's mailbox, status, mobile phone number, and other related information, it is stored locally through vuex,cookie when logging in, and when needed, it can be obtained dynamically through computed.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46691-44bce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46691-44bce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?