base64字符串转图片
使用说明
import { MUtils } from '@yl/super-jssdk';
MUtils.imageWithBase64String(optional)
参数说明
| 参数 |
类型 |
必填 |
作用 |
| optional |
Object |
是 |
必选参数 |
optional
| 参数 |
类型 |
必填 |
作用 |
| content |
String |
是 |
base64 字符串(不包括"data:image/png;base64,") |
| path |
String |
是 |
图片存储路径,(绝对路径) |
返回说明
| 参数 |
类型 |
作用 |
| resolve |
Function |
成功回调 |
| reject |
Function |
失败回调 |
代码示例
let content = "pKfwILCebSQSIZoQAAAABJRU5ErkJggg==";
let path = cordova.file.externalApplicationStorageDirectory + 'base64.jpg';
MUtils.imageWithBase64String({
content,
path
}).then(res => {
console.log('res', res);
}).catch(err => {
console.log('err', err);
})