Vue loading data is faster than data acquisition.

when the page is loaded,
data has not yet been obtained,
but my component has been loaded.
although all the data is displayed, there is still an error message

.

clipboard.png
Image prompt is that image does not exist when the component is loaded, but in the end, although the images are all rendered, is there any way for me to get the data and render the data?

Apr.02,2021

v-if data&&data.image the data here is the parent of your image
or declare the data you want to render in data first, and assign it to null


to see if the this is pointing wrong? Get the data and put it in created


use vMuif. render the component or img tag after you have the data.
if you just want to get rid of this error, just do a fault-tolerant treatment inside the component. If the picture fails to load, you can write an instruction to display the default picture when it fails to load.

your error report is probably because you are using info.image, but info is not an object is null,
so the default value of info in the props of the component can be defined as empty object {}

.

$nextTick (function () {}), talk about
https://blog.csdn.net/shuidin.

Menu