From 59784804ee3282dc4e9d473bbca677bc451a5a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Wed, 20 Mar 2024 18:00:09 +0800 Subject: [PATCH] =?UTF-8?q?dialog=20=E9=81=AE=E7=BD=A9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Dialog/src/Dialog.vue | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/Dialog/src/Dialog.vue b/src/components/Dialog/src/Dialog.vue index 69aba1b11..a7d75553a 100644 --- a/src/components/Dialog/src/Dialog.vue +++ b/src/components/Dialog/src/Dialog.vue @@ -51,7 +51,7 @@ watch( } ) -const demo = ref() +let demo = null watch( () => props.vLoading, async (val: boolean) => { @@ -59,7 +59,7 @@ watch( if (val) { initDialog() } else { - demo.close() + if (demo !== null) demo.close() } }, { @@ -76,11 +76,7 @@ const dialogStyle = computed(() => { const initDialog = () => { // 用服务生成一个el-loading实例,包括了自定义svg的指令如何在服务中使用 - demo.value = ElLoading.service({ target: '.loading', text: '加载中...', background: 'rgba(246, 246, 246, 0.8)' }) - // setTimeout(() => { - // // 延时执行关闭,对应dom清除,如要再使用loading,需重新生成新实例 - // demo.close() - // }, 5000) + demo = ElLoading.service({ target: '.loading', text: '加载中...', background: 'rgba(246, 246, 246, 0.8)' }) }