美文网首页
vue中默认图片

vue中默认图片

作者: 依耳私语 | 来源:发表于2019-01-28 11:48 被阅读0次
<img :src="imgArr[index].src" :class="{'rotate': imgArr[index].rotate, 'bill-image': !imgArr[index].rotate }" @click="showImage(index)" :onerror="errorImg">
图片的onerror属性只可以监听src的属性值是空字符串才会显示默认图片;其他类型都不可以监听到。

errorImg属性值为errorImg: 'this.src="' + require('../assets/img_default_grey.png') + '"',;

相关文章

网友评论

      本文标题:vue中默认图片

      本文链接:https://www.haomeiwen.com/subject/htcajqtx.html