//base64转blob
    toBlob(base64Data) {
      let byteString = base64Data;
      if (base64Data.split(",")[0].indexOf("base64") >= 0) {
        byteString = atob(base64Data.split(",")[1]);
      } else {
        byteString = unescape(base64Data.split(",")[1]);
      }
      // 获取文件类型
      let mimeString = base64Data.split(";")[0].split(":")[1];
      let uintArr = new Uint8Array(byteString.length);
      for (let i = 0; i < byteString.length; i++) {
        uintArr[i] = byteString.charCodeAt(i);
      }
      // 生成blob
      const blob = new Blob([uintArr], {
        type: mimeString,
      });
      return blob;
    },

freeman_Tian
12 声望2 粉丝