在wx.showActionSheet内使用wx.chooseImage时, 异常

发布于 7 年前作者 xiulan761731 次浏览最后编辑 7 年前来自 issues

我想实现的需求: 点击按钮弹出actionsheet, 点击其中一项, 执行wx.chooseImage, 在相册中选择照片;

实际表现: 点击按钮弹出actionsheet, 点击其中一项, wx.chooseImage没有执行, 而是又__重新弹出了一遍actionsheet__, 再次点击其中一项, wx.chooseImage可正常执行;

代码:

chooseImageActionNow: function (e){

var that = this;

wx.showActionSheet({

itemList: [‘拍照’, ‘从手机相册选择’],

success(res){

if (res.tapIndex == 0){

}

else if (res.tapIndex == 1){

that.chooseImageFromPhotoAlbum();

}

},

})

}

chooseImageFromPhotoAlbum()

{

var that = this;

wx.chooseImage({

count: 3 - that.data.uploaderNum, // 默认9

sizeType: [‘original’, ‘compressed’], // 可以指定是原图还是压缩图,默认二者都有

sourceType: [‘album’, ‘camera’], // 可以指定来源是相册还是相机,默认二者都有

success: function (res)

{

let tempFilePaths = res.tempFilePaths;

let uploaderList = that.data.uploaderList.concat(tempFilePaths);

}

that.setData({

uploaderList: uploaderList,

uploaderNum: uploaderList.length,

})

},

})

},

2 回复
xiaqiao
xiaqiao1 楼6 年前

麻烦提供能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

qxie
qxie2 楼5 年前

请忽略代码中的标点错误…