From 3f0ec5cf16fa4a4e8ccd3af34d8c31bd4ff34911 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sat, 9 Sep 2023 14:27:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=95=8C=E9=9D=A2=EF=BC=9A?= =?UTF-8?q?=E5=A7=90=E5=A7=90=E7=82=B9=E5=87=BB=E7=99=BB=E5=BD=95=E5=90=8E?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=96=AF=E7=8B=82=E9=97=AA=E5=8A=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit a79f1452b30f89983f153699e7183b202c18d50d) --- src/views/Login/components/LoginForm.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index aff7ffd3..61fe78cf 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -231,6 +231,7 @@ const getCookie = () => { } } } +const loading = ref() // ElLoading.service 返回的实例 // 登录 const handleLogin = async (params) => { loginLoading.value = true @@ -245,7 +246,7 @@ const handleLogin = async (params) => { if (!res) { return } - ElLoading.service({ + loading.value = ElLoading.service({ lock: true, text: '正在加载系统中...', background: 'rgba(0, 0, 0, 0.7)' @@ -265,13 +266,9 @@ const handleLogin = async (params) => { } else { push({ path: redirect.value || permissionStore.addRouters[0].path }) } - } catch { - loginLoading.value = false } finally { - setTimeout(() => { - const loadingInstance = ElLoading.service() - loadingInstance.close() - }, 400) + loginLoading.value = false + loading.value.close() } }