Error reporting problem caused by request delay in vue?

in the vue-cli project, I first define an empty value in data, then request the data in created and assign it to that null value.
I directly refer to this value (an array, each group has a corresponding img,name, etc.) to assign values on the page.
the result is rendered correctly, but there is an error in the console. I think it should be an empty value rendered during initialization, so the error is reported. After the data request is successful, the error will be rendered successfully.
although the current function is normal, but I do not want such an error in the project, how to solve it!

Mar.11,2021

it would be nice to define and assign an empty array in the first place


you should pay attention to distinguish what is wrong in the report.
in this case:

dataList: [{name:'test'}]

if dataList is empty, no error will be reported

this situation will report an error:

dataList: [{img: {name:'test'}}]

the empty array does not get img, and what is even more impossible to get name, error is that undefined does not have the attribute name. At this point, you have to deal with it, give the array a default value, or img.name extra processing, use a filter, etc.


should be affixed with codes and errors. The text description cannot fully restore the event


you wrote this at first, so you can't get anything in the empty array

.
dataArr:''
The

solution is to assign each of its elements to an empty value at initialization.

dataArr:[{
    'name':'',
    'img':''
}]

has found a method. Judge whether the v-if array value is not equal to empty for the element. It will be displayed only when the value is requested, and it will OK

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