提交 b0c5829e 编写于 作者: 雪洛's avatar 雪洛

fix: 修正错误示例

上级 533daab2
......@@ -8,13 +8,14 @@
<view v-for="(item,index) in data" :key="index">
<text class="uni-subtitle-text">{{item.description}}</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix" :src="item.errorImage == null ? item.src : item.errorImage" @error="imageErrorEvent(index, $event as ImageErrorEvent)"></image>
<image class="image" mode="widthFix" :src="item.errorImage == null ? item.src : item.errorImage"
@error="imageErrorEvent(index, $event as ImageErrorEvent)"></image>
</view>
</view>
<view>
<text class="uni-subtitle-text">非static目录的src静态路径:./logo.png</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix" :src="outsideStaticErrorPath == null ? outsideStaticPath : outsideStaticErrorPath" @error="imageOutsideStaticErrorEvent"></image>
<image class="image" mode="widthFix" src="./logo.png"></image>
</view>
</view>
</view>
......@@ -93,14 +94,10 @@
}
},
methods: {
imageErrorEvent(index: number, e : ImageErrorEvent) {
imageErrorEvent(index : number, e : ImageErrorEvent) {
console.log("图片加载错误", e.detail);
// 图片加载失败,加载本地占位图
this.data[index].errorImage = '/static/template/drop-card/dislike.png'
},
imageOutsideStaticErrorEvent(e: ImageErrorEvent) {
console.log("图片加载错误", e.detail);
this.outsideStaticErrorPath = '/static/template/drop-card/dislike.png'
}
},
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册