downloadFile 每次只能下载一张图,也就意味着零时文件只有一个?
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的图标,而且只有一个显示