Skip to content

Commit a79f145

Browse files
author
puhui999
committed
登录界面:姐姐点击登录后界面疯狂闪动的问题
1 parent 0e2ea39 commit a79f145

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/views/Login/components/LoginForm.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ const getCookie = () => {
230230
}
231231
}
232232
}
233+
const loading = ref() // ElLoading.service 返回的实例
233234
// 登录
234235
const handleLogin = async (params) => {
235236
loginLoading.value = true
@@ -244,7 +245,7 @@ const handleLogin = async (params) => {
244245
if (!res) {
245246
return
246247
}
247-
ElLoading.service({
248+
loading.value = ElLoading.service({
248249
lock: true,
249250
text: '正在加载系统中...',
250251
background: 'rgba(0, 0, 0, 0.7)'
@@ -264,13 +265,9 @@ const handleLogin = async (params) => {
264265
} else {
265266
push({ path: redirect.value || permissionStore.addRouters[0].path })
266267
}
267-
} catch {
268-
loginLoading.value = false
269268
} finally {
270-
setTimeout(() => {
271-
const loadingInstance = ElLoading.service()
272-
loadingInstance.close()
273-
}, 400)
269+
loginLoading.value = false
270+
loading.value.close()
274271
}
275272
}
276273

0 commit comments

Comments
 (0)