收藏
回答

ios调用公众号里面的 wx.getLocalImgData返回数据是空,安卓返回了base64

  wx.chooseImage({

                    count: 1// 默认9

                    sizeType: ['compressed'], // 'original', 'compressed' 指定是原图还是压缩图,默认都有

                    sourceType: ['album''camera'], // 指定来源是相册还是相机,默认都有

                    success: res => {

                      this.localIds = res.localIds[0]; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片

                      wx.getLocalImgData({

                        localId: res.localIds[0], //获取本地图片接口

                        success: res => {

                              this.dialog(res.localData); //ios没有base64,返回的res里面也是空的

                     

                        },

                        fail: res => {

                          this.loading = 0;

                          this.dialog('图片上传失败,请重试');

                        },

                        cancel: res => {

                          this.loading = 0;

                          // this.dialog('取消上传');

                        }

                      });

                    },

                    fail: res => {

                      this.loading = 0;

                      this.dialog('图片上传失败,请重试!');

                    },

                    cancel: res => {

                      this.loading = 0;

                      // this.dialog('取消上传!');

                    }

                  });


最后一次编辑于  09-19
回答关注问题邀请回答
收藏

2 个回答

问题标签