收藏
回答

downloadFile 每次只能下载一张图,也就意味着零时文件只有一个?

问题模块
API和组件
wx.request({
        url: ` `,
        header: {
            'content-type': 'application/json'
        },
        method:'post',
        success: function(res) {
          if(res.status = 1){
            var arr = res.data.result
            for (var i = 0; i < arr.length; i++) {
              that.setData({
                marker: arr[i]
              });
              var iconPath = that.data.marker['iconPath']
              wx.downloadFile({
                url: iconPath,
                success: function (res) {
                   
                  that.data.marker['iconPath'] = res.tempFilePath
                  console.log(res.tempFilePath)
                  that.setData({
                    markers: that.data.markers.concat(that.data.marker)
                  })
                }
              })
            }
          }
        }
      });

每次都是只显示最后一个markers的图标,而且只有一个显示

最后一次编辑于  2017-05-22  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏关注问题回答