wx.chooseImage ios不能调用 安卓图片不显示
发布于 4 年前 作者 guiyinggu 5954 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)
  • 预期表现
  • 复现路径
  • 提供一个最简复现 Demo

上传图片iOS的不能打开本地相册,安卓图片不显示

frontimage: function () {

     console.log(“9292838”)

     var that = this;

     var Type = that.data.sourceType

     wx.chooseImage({

       count: 1, // 默认9

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

       sourceType: Type, // 可以指定来源是相册还是相机,默认二者都有

       success: function (res) {

         // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片

         console.log(res,134)

         that.setData({

           FilePaths: res.tempFilePaths,

         })

         wx.uploadFile({

           url: ‘后台接口’,

           filePath: res.tempFilePaths[0],

           header: {

             sessionKey: that.data.sessionKey

           },

           name: ‘photo’,

           formData: {

             realName: that.data.idcardname,

             identification: that.data.idcard,

           },

           success(res) {

             console.log(res)

             const data = res.data

             // do something

           }

         })

       }

     })

   },

1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部