<template>
<!-- 每一条 -->
<view class="main-bd-item" v-for="(item,index) in cardList" :key="index" >
<image class="bd-item-rg" :src="item.pic" @error="onErrorImg(item)" @load="onSuccessImg(item)"></image>
</view>
</template>
<script>
import {
imgUrl
} from "../../network/config.js"
import {
mapState,
mapGetters,
mapMutations,
mapActions
} from 'vuex'
export default {
data() {
return {
defaultImg: imgUrl + '/antiy/20210412/黑客使用假冒Clubhouse应用传播恶意软件/Report/images/ac58621dc3a2c7e7b1cb182f936b2d2c.jpg',
}
},
methods: {
onSuccessImg(item) {
},
onErrorImg(item) {
this.$set(item, 'pic', this.defaultImg);
},
}
}
</script>
uni-app监测网络图片是否可用,不可用显示默认图片
最新推荐文章于 2024-05-22 17:04:44 发布