Vue component data refresh problem

A user name in one of my header components is obtained through localstorage, but it must be refreshed manually before it can be displayed. Can the component refresh and obtain data by itself?-sharp-sharp-sharp problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Jul.17,2021

what you shouldn't think about is how to get it without refreshing it. If you save it in localStorage , you can try to get it in the parent component and pass it to the child component when the child component initializes


1. If rendering is slow at the beginning, you can use ide/components-dynamic-async.html-sharpad" rel=" nofollow noreferrer "> Asynchronous component
or use

this.$nextTick(()=>{
    //
})

2. If the data involves midway modification and the parent component is passed to the child component, then the child component uses watch to listen for the content passed by the parent component


do you mean that after a successful login, the information is written in localstorage, and the top component gets the data of localstorage, but the data is empty, and it will be fine after refreshing. I have encountered this kind of

before.
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-1b3631b-2bfdb.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-1b3631b-2bfdb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?