From 02aa7fc88945792c8beb04bcb7293af89470df81 Mon Sep 17 00:00:00 2001 From: vben Date: Wed, 11 Sep 2024 22:56:22 +0800 Subject: [PATCH] fix: select components used in modal pop-ups cannot be selected --- packages/@core/base/design/src/css/global.css | 7 +++- .../ui-kit/popup-ui/src/modal/modal-api.ts | 1 + .../@core/ui-kit/popup-ui/src/modal/modal.ts | 4 +++ .../@core/ui-kit/popup-ui/src/modal/modal.vue | 9 ++++++ .../src/ui/authentication/code-login.vue | 27 ++++++++++++++-- .../src/ui/authentication/forget-password.vue | 30 ++++++++++++++--- .../common-ui/src/ui/authentication/login.vue | 19 ++++++++--- .../src/ui/authentication/qrcode-login.vue | 32 +++++++++++++++++-- .../src/ui/authentication/register.vue | 29 +++++++++++++++-- .../common-ui/src/ui/authentication/types.ts | 4 +++ .../layouts/src/authentication/toolbar.vue | 4 +-- .../views/examples/modal/form-model-demo.vue | 13 ++++++++ 12 files changed, 157 insertions(+), 22 deletions(-) diff --git a/packages/@core/base/design/src/css/global.css b/packages/@core/base/design/src/css/global.css index 9fb8c9c794a..5f4ecaf0ea0 100644 --- a/packages/@core/base/design/src/css/global.css +++ b/packages/@core/base/design/src/css/global.css @@ -31,10 +31,14 @@ #app, body, html { - @apply size-full overscroll-none; + @apply !pointer-events-auto size-full overscroll-none; + + /* scrollbar-gutter: stable; */ } body { + @apply size-full overscroll-none; + min-height: 100vh; /* overflow: overlay; */ @@ -90,6 +94,7 @@ } /* 只有非mac下才进行调整,mac下使用默认滚动条 */ + html:not([data-platform='macOs']) { ::-webkit-scrollbar { @apply h-[10px] w-[10px]; diff --git a/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts b/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts index e664c52f5e0..eaa0cf844a7 100644 --- a/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts +++ b/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts @@ -41,6 +41,7 @@ export class ModalApi { isOpen: false, loading: false, modal: true, + openAutoFocus: false, showCancelButton: true, showConfirmButton: true, title: '', diff --git a/packages/@core/ui-kit/popup-ui/src/modal/modal.ts b/packages/@core/ui-kit/popup-ui/src/modal/modal.ts index 3ccbacd47ec..8a5bbf31f3b 100644 --- a/packages/@core/ui-kit/popup-ui/src/modal/modal.ts +++ b/packages/@core/ui-kit/popup-ui/src/modal/modal.ts @@ -75,6 +75,10 @@ export interface ModalProps { * @default true */ modal?: boolean; + /** + * 是否自动聚焦 + */ + openAutoFocus?: boolean; /** * 是否显示取消按钮 * @default true diff --git a/packages/@core/ui-kit/popup-ui/src/modal/modal.vue b/packages/@core/ui-kit/popup-ui/src/modal/modal.vue index 8a5cc4a8387..89ea4128898 100644 --- a/packages/@core/ui-kit/popup-ui/src/modal/modal.vue +++ b/packages/@core/ui-kit/popup-ui/src/modal/modal.vue @@ -68,6 +68,7 @@ const { header, loading: showLoading, modal, + openAutoFocus, showCancelButton, showConfirmButton, title, @@ -133,6 +134,13 @@ function escapeKeyDown(e: KeyboardEvent) { e.preventDefault(); } } + +function handerOpenAutoFocus(e: Event) { + if (!openAutoFocus.value) { + e?.preventDefault(); + } +} + // pointer-down-outside function pointerDownOutside(e: Event) { const target = e.target as HTMLElement; @@ -166,6 +174,7 @@ function pointerDownOutside(e: Event) { close-class="top-3" @escape-key-down="escapeKeyDown" @interact-outside="interactOutside" + @open-auto-focus="handerOpenAutoFocus" @pointer-down-outside="pointerDownOutside" > (), { loading: false, loginPath: '/auth/login', + submitButtonText: '', + subTitle: '', + title: '', }); const emit = defineEmits<{ @@ -69,16 +84,22 @@ function goToLogin() {