fix: 构建报错
Former-commit-id: c0a09d5c93cea56774f3a6e54aee3cd23b5c352c
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { uploadFileApi } from "@/api/file";
|
||||
import { makeInstaller } from "element-plus";
|
||||
|
||||
const imgUrl = ref("");
|
||||
const canvas = ref();
|
||||
@@ -102,14 +103,17 @@ const handleSaveImg = () => {
|
||||
const dataURLtoFile = (dataurl: string, filename: string) => {
|
||||
const arr: string[] = dataurl.split(",");
|
||||
if (!arr.length) return;
|
||||
const mime = arr[0]?.match(/:(.*?);/)[1];
|
||||
const bstr = atob(arr[1]);
|
||||
let n = bstr.length;
|
||||
const u8arr = new Uint8Array(n);
|
||||
while (n--) {
|
||||
u8arr[n] = bstr.charCodeAt(n);
|
||||
|
||||
const mime = arr[0].match(/:(.*?);/);
|
||||
if (mime && !mime.length) {
|
||||
const bstr = atob(arr[1]);
|
||||
let n = bstr.length;
|
||||
const u8arr = new Uint8Array(n);
|
||||
while (n--) {
|
||||
u8arr[n] = bstr.charCodeAt(n);
|
||||
}
|
||||
return new File([u8arr], filename, { type: mime[0] });
|
||||
}
|
||||
return new File([u8arr], filename, { type: mime });
|
||||
};
|
||||
// canvas 画图
|
||||
function paint(
|
||||
|
||||
Reference in New Issue
Block a user