0
点赞
收藏
分享

微信扫一扫

微信小程序--图片转base64


前言

在很多时候,我们需要图片的base64码,一般利用自己封装的function,但是微信小程序中可以利用 wx.getFileSystemManager().readFile

代码

//转base64 
wx.getFileSystemManager().readFile({
filePath: imgpath,// 图片地址 本地or网络
encoding: "base64",
success: res => {
consol.log(res.data)// res.data就是转换完的base64
},
fail: res => {
}
})


举报

相关推荐

0 条评论