您当前的位置: 首页 > 

任磊abc

暂无认证

  • 3浏览

    0关注

    182博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

uni-app 获取图片base64

任磊abc 发布时间:2021-07-08 17:42:58 ,浏览量:3

uni.chooseImage({
                        count: 1, //默认9
                        sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
                        sourceType: ['album'], //从相册选择
                        success: function(res) {
                                console.log(res)
                                that.headportrait = res.tempFilePaths[0]
                                wx.getFileSystemManager().readFile({
                                     filePath: res.tempFilePaths[0],
                                              encoding: 'base64',
                                              success: response => { 
                                                let base64 = 'data:image/png;base64,' + response.data
                                                console.log(base64)
                                              }
                                })
                        }
                    });

关注
打赏
1656830895
查看更多评论
立即登录/注册

微信扫码登录

0.0353s