转自 · · 858 阅读

uni-app 图片404使用默认图片

uniapp
uni-app 图片404使用默认图片

uni-app image 的 @error 方法,默认图片需要使用PNG格式,比如图片404了访问不了就可以使用 @error

注意:imgError方法不能传图片路径,而是传图片整条数据

html

js

methods:{

imgError(item) {

    item.image = require('../../static/logo.png');

},

}

0 评论

评论

还没有评论,来说两句吧