From eff2f60bd76c618b7f634693112548be57b60e70 Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Mon, 9 Oct 2023 16:49:51 +0800 Subject: [PATCH] feat: handlePanelBlur --- src/components/capture/Capture.vue | 2 +- src/components/top-bar/KUNGalgameTopBar.vue | 2 +- src/components/top-bar/KUNGalgameUserInfo.vue | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/capture/Capture.vue b/src/components/capture/Capture.vue index 7d593fe9..ad12b965 100644 --- a/src/components/capture/Capture.vue +++ b/src/components/capture/Capture.vue @@ -160,7 +160,7 @@ const submitAnswer = () => {
{{ $tm('AlertInfo.capture.hint4') }}
diff --git a/src/components/top-bar/KUNGalgameTopBar.vue b/src/components/top-bar/KUNGalgameTopBar.vue index 7e36f3c8..c0889ca6 100644 --- a/src/components/top-bar/KUNGalgameTopBar.vue +++ b/src/components/top-bar/KUNGalgameTopBar.vue @@ -97,7 +97,7 @@ onBeforeRouteLeave(() => {
diff --git a/src/components/top-bar/KUNGalgameUserInfo.vue b/src/components/top-bar/KUNGalgameUserInfo.vue index ad9ac7ad..5fc6d2c0 100644 --- a/src/components/top-bar/KUNGalgameUserInfo.vue +++ b/src/components/top-bar/KUNGalgameUserInfo.vue @@ -2,6 +2,22 @@ import { onMounted, ref } from 'vue' const container = ref() +const emit = defineEmits({ + close, +}) + +// 失去焦点时关闭面板 +const handlePanelBlur = async () => { + // 等待一段时间,不然会直接导致面板关闭 + await new Promise((resolve) => { + setTimeout(resolve, 107) + }) + emit('close') +} + +// 退出登录 +const logOut = () => {} + onMounted(() => { // 自动获取焦点 container.value?.focus() @@ -9,7 +25,7 @@ onMounted(() => {