微信小程序安卓系统下不显示BASE64图片问题

<image>标签中的data属性必须写为:image/png

不能是img/png    或者是jpg等其他格式

that.setData({ url: 'data:image/png;base64,' + data});

否则,在IOS下没问题,安卓下集体出BUG!

还需要补充的是后台返回的数据不能有空格和换行符:

使用下面方式去掉空格和换行符。

base64Url = base64Url.replace(/\ +/g, ""); //去掉空格方法

base64Url = base64Url.replace(/[\r\n]/g, "");

猜你喜欢

转载自blog.csdn.net/ww350323242/article/details/88025081
今日推荐