wx.chooseImage不弹出选择相册、相机框
发布于 6 年前 作者 chao49 10737 次浏览 来自 官方Issues

部分用户反馈说是点击没有任何任何反映

2 回复

请具体描述问题出现的流程,并提供能复现问题的简单代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

出现问题的手机扫码提供下扫码结果截图



chooseImage: function (e) {
    var _this = this;
    //发起uploadfile
    wx.chooseImage({
      count: 1, //最多上传1张
      success: function (retFile) {
        console.log(retFile)
        var tempFilesSize = retFile.tempFiles[0].size;  //获取图片的大小,单位B
        if (tempFilesSize < 1048576) {
          var tempFilesPath = retFile.tempFilePaths[0];  //获取图片临时路径
          //判断是否是jpg、png格式
          app.wxRequest('?m=weixin&c=index&a=uploadSuffix', { path: tempFilesPath }).then(
            res => {
              //请求成功 保存临时路径
              if (res.code == 1) {
                _this.setData({ up_img: tempFilesPath, preview: true });
              } else {
                app.showAlert(res.msg)
              }
            }
          )
        } else {
          app.showAlert('上传图片不能大于1MB!');
        }
      }
    })
  },
回到顶部