1.你的目的是沒有圖片展示默認圖片?
<img :src="item.file.url?item.file.url:defaultUrl" alt="" width="80px" height="80px"/>;
2.你的目的是圖片加載失敗時才展示默認圖片?
<img :src="item.file.url" alt="" width="80px" height="80px" @error="loadErrorFun(item.index)" /> //注意:index是v-for的參數(shù)。
loadErrorFun(index){
??? this.listData[index].item.file.url = defaultUrl;
??? this.$forceUpdate();
}