图片返回404时候的处理
<img
:src="userMsg.portrait"
ref="img"
alt="">
_this.$refs.img.onerror = function(){
_this.userMsg.portrait = require('@/assets/images/user_img.jpeg')
}
图片返回404时候的处理
<img
:src="userMsg.portrait"
ref="img"
alt="">
_this.$refs.img.onerror = function(){
_this.userMsg.portrait = require('@/assets/images/user_img.jpeg')
}
转载于:https://www.cnblogs.com/karila/p/9019391.html