💄 更新配置文件和优化图片下载逻辑

This commit is contained in:
目棃
2025-04-01 14:08:50 +08:00
parent 01009b36eb
commit 7cf4516865
2 changed files with 6 additions and 4 deletions

View File

@@ -86,14 +86,16 @@ async function onDownload(): Promise<void> {
showOri.value = true;
await nextTick();
}
await showLoading.start("正在下载图片到本地", props.image.insert.image);
const image = props.image.insert.image;
await showLoading.start("正在下载图片到本地", image);
if (buffer.value === null) buffer.value = await getImageBuffer(image);
if (buffer.value.byteLength > 80000000) {
showSnackbar.warn("图片过大,无法下载到本地");
return;
}
await saveCanvasImg(buffer.value, Date.now().toString(), format.value);
let fileName = image.split("/").pop()?.split(".")[0];
if (fileName === undefined) fileName = Date.now().toString();
await saveCanvasImg(buffer.value, fileName, format.value);
await showLoading.end();
}
</script>

View File

@@ -1,7 +1,7 @@
/**
* @file vite.config.ts
* @description vite 配置文件
* @since Beta v0.7.2
* @since Beta v0.7.3
*/
import vue from "@vitejs/plugin-vue";
@@ -35,5 +35,5 @@ export default defineConfig({
watch: { ignored: ["**/src-tauri/**"] },
},
esbuild: { supported: { "top-level-await": true } },
build: { chunkSizeWarningLimit: 4096 },
build: { chunkSizeWarningLimit: 8192 },
});