From 11ec263a6489f0dd5884307d2daee20fd87adff0 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 28 May 2024 15:03:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=8A=BD=E5=B1=89=E4=B8=AD=20=E7=BB=98=E7=94=BB?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=9B=BE=E7=89=87=E4=B8=8D=E8=83=BD=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=8A=A0=E8=BD=BD=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageDetailDrawer.vue | 1 - src/views/ai/image/ImageTaskCard.vue | 21 +++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/views/ai/image/ImageDetailDrawer.vue b/src/views/ai/image/ImageDetailDrawer.vue index b3d76ea4..5734cf30 100644 --- a/src/views/ai/image/ImageDetailDrawer.vue +++ b/src/views/ai/image/ImageDetailDrawer.vue @@ -112,7 +112,6 @@ watch(show, async (newValue, oldValue) => { // watch id const { id } = toRefs(props) watch(id, async (newVal, oldVal) => { - console.log('newVal', newVal) if (newVal) { await getImageDetail(newVal) } diff --git a/src/views/ai/image/ImageTaskCard.vue b/src/views/ai/image/ImageTaskCard.vue index 6c3e1278..24fc1194 100644 --- a/src/views/ai/image/ImageTaskCard.vue +++ b/src/views/ai/image/ImageTaskCard.vue @@ -41,12 +41,8 @@ const handlerBtnClick = async (type, imageDetail: ImageDetailVO) => { emits('onBtnClick', type, imageDetail) } -// emits -const emits = defineEmits(['onBtnClick']) - -// -onMounted(async () => { - if (props.imageDetail.status === 'in_progress') { +const handlerLoading = async (status: string) => { + if (status === 'in_progress') { cardImageLoadingInstance.value = ElLoading.service({ target: cardImageRef.value, text: '生成中...' @@ -57,6 +53,19 @@ onMounted(async () => { cardImageLoadingInstance.value = null; } } +} +// watch +const { imageDetail } = toRefs(props) +watch(imageDetail, async (newVal, oldVal) => { + await handlerLoading(newVal.status as string) +}) + +// emits +const emits = defineEmits(['onBtnClick']) + +// +onMounted(async () => { + await handlerLoading(props.imageDetail.status as string) })