ios选择图片后临时路径不能作为背景图
发布于 5 年前 作者 wenxiuying 1623 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

在ios下小程序选择图片后,拿临时路径作为 background 时不会显示。

  • 预期表现

临时路径作为background能正常显示

  • 复现路径
  • 提供一个最简复现 Demo
<view style="height: {{height}}px; width: {{width}}px; background: url('{{background}}');background-position: 0 0; background-size: {{width}}px {{height}}px" >
</view>
chooseImg() {
   wx.chooseImage({
     success: (img) => {
       this.setData({
         hasChoosedImg: true,
       })
       wx.getImageInfo({
         src: img.tempFilePaths[0],
         success: (res) => { 
           this.setData({

             width: res.width,

            height: res.height,

background: res.path,

           });
         }
       })
     },
     fail: function (err) {

       console.log(err);

}

})

}


 
3 回复

临时路径为背景图渲染不了

仅支持网络路径的图片

解决了吗?临时路径 安卓手机是好用的 但是ios 貌似不支持

回到顶部