The first time the page is loaded in vue, there is no value in the data object. It will be fine after refreshing.

uses the background management system made by vue. When entering for the first time, the page data is not loaded. An error is reported: Cannot read property "realname" of undefined
. After refreshing, the value will come out
before the page is refreshed.

this this.user is the value used

.
Mar.12,2021
Try

in created.


add a "user" to the div


this should be the wrong initial value of the user variable you gave.
get the background data only after your api is mounted, and one of the data objects returned in the background is realname,. When you are in mounted, while the data is being acquired, the template has already been initialized and rendered, so the template needs the realname attribute value in your user. If there is any in your initialization value, you should not report an error


.

get the data of asynchronously, right? Add a user to the div corresponding to "basic data" ,

your getSysUser method looks a little strange. Is it asynchronous? If it is Promise , then less await and async

are written.
   
get the returned value in the middle and assign it. Only when you enter this page for the first time will no data appear. Just refresh it

.
Menu