收藏
回答

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

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug wx.chooseImage 微信iOS客户端 7.0.3 2.8.3

我想实现的需求: 点击按钮弹出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 个回答

登录 后发表内容
问题标签