How to display loading.gif? in vue when the picture is not loaded

what I want to do is to display the loading.gif diagram when the picture is not loaded.
my picture (figure 9) is in a div1, and the address of the picture is in the array imgPath = []. When the array is empty, the div1, of div1 is created
when the array is not empty. I wrote img.onload, in the mounted hook function, but it seems that because the div is not created, this img.onload has no effect. I don"t know if this is the case. Of course, my focus is on how to display the loading.gif diagram

when the picture is not loaded.

when the array imgPath is not empty, the image address defaults to loading.gif, until a href= "https://codepen.io/luren/pen/MXaVwX" rel=" nofollow noreferrer "demo

is replaced by the real image when you think it is appropriate.
Menu