fix: 当图片404的时候不能初始化的问题

pull/150/head
xingyu4j 2025-06-18 15:16:46 +08:00
parent a311622334
commit 66d8690238
1 changed files with 9 additions and 1 deletions

View File

@ -44,6 +44,14 @@ const [Modal, modalApi] = useVbenModal({
if (isOpen) { if (isOpen) {
// loading CropperImage loading handleReady // loading CropperImage loading handleReady
modalLoading(true); modalLoading(true);
const img = new Image();
img.src = src.value;
img.addEventListener('load', () => {
modalLoading(false);
});
img.addEventListener('error', () => {
modalLoading(false);
});
} else { } else {
// //
previewSource.value = ''; previewSource.value = '';
@ -208,7 +216,7 @@ async function handleOk() {
> >
<template #icon> <template #icon>
<div class="flex items-center justify-center"> <div class="flex items-center justify-center">
<IconifyIcon icon="vaadin--arrows-long-h" /> <IconifyIcon icon="vaadin:arrows-long-h" />
</div> </div>
</template> </template>
</Button> </Button>