wx.getImageInfo 读取本地图片报错

wx.getImageInfo读取本地文件报错:

wx.getImageInfo({
      src: '../images/common/youmaipaigongzhonghao.png',
      success(res) {},
      fail(err) {console.log(err)}
    });

错误日志:{errMsg: "getImageInfo:fail file not found"}
错误原因:src 路径不对,images路径前不应该加..
修改如下:

wx.getImageInfo({
      src: '/images/common/youmaipaigongzhonghao.png',
      success(res) {},
      fail(err) {}
    });

你可能感兴趣的:(wx.getImageInfo 读取本地图片报错)