为什么在onload时,request数据后改变data中图片地址,真机上不显示图片?

小程序 文章 2022-02-23 09:20 340 0 全屏看文

AI助手支持GPT4.0

为什么在onload时,request数据后改变data中图片地址,真机上不显示图片?Why is the image address in data changed after requesting data during onload, but the image is not displayed on the real machine?

为什么在onload时,request数据后改变data中图片地址,真机上不显示图片?

为什么在onload时,request数据后改变data中图片地址,真机上不显示图片?但是开发工具上正常显示呢

Why does the address of the picture in the data change after the request data when onload, and the picture is not displayed on the real machine? But what about the normal display on the development tool

回答:

星尘:

查看下图片地址 看看会不会是拼接问题 或者将地址复制到浏览器上看看是否有效

zy:

可以先把图片复制到浏览器看下是否有效

dreamhunter:

需要用setData https://developers.weixin.qq.com/miniprogram/deveference/api/Page.html#%E7%BB%84%E4%BB%B6%E4%BA%8B%E4%BB%B6%E5%A4%84%E7%90%86%E5%87%BD%E6%95%B0

  1. 直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致


brave:提供下可复现问题的代码片段

-EOF-

AI助手支持GPT4.0