blob转base64
const blobToDataUrl = (blob) => {
const idBlob = Object.prototype.toString.call(blob) === '[object Blob]';
if (idBlob) {
const DataUrl = new Promise((resolve) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = function (e) {
resolve(e.target.result);
};
});
return DataUrl;
}
return blob;
};