// 添加图片
pickimg_tap: function () {
var self = this;
if (self.data.imgList.length >= 8) {
AlertMessage(self, '只能选择8张图片!')
return;
}
wx.chooseImage({
count: 8, // 最多可以选择的图片张数,默认9
sizeType: ['compressed'], // original 原图,compressed 压缩图,默认二者都有
sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
success: function (res) {
var tempFilePaths = res.tempFilePaths;
var lst = self.data.imgList;
tempFilePaths.forEach(p => {
if (lst.length >= 8) {
return;
}
lst.push(p);
});
self.setData({ imgList: lst });
console.log(self.data.imgList)
},
fail: function () {
// fail
},
complete: function () {
// complete
}
})
},