美文网首页
uniapp开发小程序,图片加载失败显示默认图片

uniapp开发小程序,图片加载失败显示默认图片

作者: 花影_62b4 | 来源:发表于2023-10-24 14:58 被阅读0次
<image :src="industry.mobileAppIconUrl" mode="aspectFill" @error="handleImageError(industry)"></image>
data() {
            return {                
                defaultPic:'/static/images/theme/industry_fail.png'
            }
        },
methods: {
            //图片加载失败使用默认图片
            handleImageError(aitem) {
               aitem.mobileAppIconUrl = this.defaultPic;
            },
}

相关文章

网友评论

      本文标题:uniapp开发小程序,图片加载失败显示默认图片

      本文链接:https://www.haomeiwen.com/subject/okkqidtx.html