fix: 当图片404的时候不能初始化的问题
parent
a311622334
commit
66d8690238
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue