系统选择照片或拍照的API( wx.chooseImage),获取的tempFilePaths数组里面永远只有一个对象,如下
bjecterrMsg: "chooseImage:ok"
tempFilePaths: Array[1]
0: "wxfile://tmp_18680686o6zAJs2ooDfy_90wigsmIiB6AO201483522458149.png"
length: 1…
暂时解决的办法是创建一个临时数组,每次选择后自己添加到临时数组里面,代码如下:
chooseImage: function () {
var that = this
wx.chooseImage({
sourceType: ['camera', 'album'],
sizeType: ['compressed', 'original'] ,
count: 3,
success: function (res) {
console.log(res)
var tempArray = that.data.imageList;
tempArray.push(res.tempFilePaths);
that.setData({
imageList:tempArray
})
}
})
},
坐等官方更新修复。😌😌😌😌😌😌😌
有问题的写法是怎么样的?
@Can,setData里面直接设置:
that.setData({
imageList : res.tempFilePaths
})