Where in the file img Add: οnerrοr = "errorImg01", and then set the path if direct written errorImg01
errorImg01: ( '../../assets/images/item_image.png'), will not find this image
Since the project started, the image path is not the path we write up. So we use
errorImg01: 'this.src = "' + require ( '../../ assets / images / item_image.png') + '"' to request the image.
<template> <div class="goods_img"> <img :src="item.PicUrl" alt="" :onerror="errorImg01"> </div> </template> <script> export default { name: "ListItems", data () { return { errorImg01: 'this.src="' + require('../../assets/images/item_image.png') + '"' } } } </script>
---------------------
Author: Gion want quiet.
Source: CSDN
Original: https: //blog.csdn.net/jingjingshizhu/article/details/81315841
Copyright: This article is a blogger original article, reproduced, please attach Bowen link!