map组件下marks的iconPath不支持网络图片?!!
发布于 5 年前 作者 ayao 17818 次浏览 来自 问答
    markers: [{
      iconPath: "/resources/others.png",
      id: 0,
      latitude: 23.099994,
      longitude: 113.324520,
      width: 50,
      height: 50
    }],

当iconPath:"https://www.hearthome520.com/up/ico.png"不起作用!

4 回复

开发者工具上无效吗?我转化后还是默认图片

你怎么处理批量MARKS里面的图标的?

全下载下来啊

for (var i = 0; i < gm.length; i++) {
    (function (i) {
        wx.downloadFile({
        url: app.data.server + 'avatar/' + gm[i].openId + '.png',
        success: function (res) {
            if (res.statusCode === 200) {
                buf[i].iconPath = res.tempFilePath
            }
            buf[i].latitude = gm[i].latitude
            buf[i].longitude = gm[i].longitude
            markers.push(buf[i])
            page.oneDownloadFinish()
            }
        })
    })(i)
}

我也刚遇到,得用wx.downloadFile下载到微信缓存,然后引用缓存路径

回到顶部