1.html
<img :src="imgShow(imgUrl)" />
2.js
// display image, if the normal display picture, if not, the default image
data ()
imgUrl:'',
mothods:
imgShow:function(data){ let reg = /^(https:|http:)/g; if(data){ if(reg.test(data)){ return data; }else{ return 'http://192.168.0.176:8888/assets/img/item4.png'; } }else{ return 'http://192.168.0.176:8888/assets/img/404.png'; } }