From d00d31d739dc0b2c5fe6277fc8a63d74b5634781 Mon Sep 17 00:00:00 2001 From: xingyu <xingyu4j@vip.qq.com> Date: Wed, 27 Sep 2023 10:24:48 +0800 Subject: [PATCH] =?UTF-8?q?Chore:=20=E5=A4=84=E7=90=86=E4=BA=86Vben?= =?UTF-8?q?=E5=B0=81=E8=A3=85=E7=9A=84Drawer,Modal=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Drawer/src/BasicDrawer.vue | 2 +- src/components/Drawer/src/typing.ts | 6 +++--- src/components/Drawer/src/useDrawer.ts | 10 +++++----- src/components/Modal/src/components/ModalWrapper.vue | 2 +- src/components/Modal/src/hooks/useModal.ts | 8 ++++---- src/components/Modal/src/typing.ts | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/Drawer/src/BasicDrawer.vue b/src/components/Drawer/src/BasicDrawer.vue index c4f66120..7d2b9809 100644 --- a/src/components/Drawer/src/BasicDrawer.vue +++ b/src/components/Drawer/src/BasicDrawer.vue @@ -133,7 +133,7 @@ function handleOk() { </script> <template> - <Drawer :root-class-name="prefixCls" v-bind="getBindValues" @close="onClose"> + <Drawer v-bind="getBindValues" @close="onClose"> <template v-if="!$slots.title" #title> <DrawerHeader :title="getMergeProps.title as any" :is-detail="isDetail" :show-detail-back="showDetailBack" diff --git a/src/components/Drawer/src/typing.ts b/src/components/Drawer/src/typing.ts index 43af292e..e0e6c90b 100644 --- a/src/components/Drawer/src/typing.ts +++ b/src/components/Drawer/src/typing.ts @@ -3,7 +3,7 @@ import type { CSSProperties, ComputedRef, VNodeChild } from 'vue' import type { ScrollContainerOptions } from '@/components/Container' export interface DrawerInstance { - setDrawerProps: (props: Partial<DrawerProps> | boolean) => void + setDrawerProps: (props: Partial<DrawerProps>) => void emitOpen?: (open: boolean, uid: number) => void } @@ -13,7 +13,7 @@ export interface ReturnMethods extends DrawerInstance { getOpen?: ComputedRef<boolean> } -export type RegisterFn = (drawerInstance: DrawerInstance, uuid?: string) => void +export type RegisterFn = (drawerInstance: DrawerInstance, uuid: number) => void export interface ReturnInnerMethods extends DrawerInstance { closeDrawer: () => void @@ -100,7 +100,7 @@ export interface DrawerProps extends DrawerFooterProps { * @default 'body' * @type any ( HTMLElement| () => HTMLElement | string) */ - getContainer?: () => HTMLElement | string + getContainer?: string | false | HTMLElement | (() => HTMLElement) /** * Whether to show mask or not. diff --git a/src/components/Drawer/src/useDrawer.ts b/src/components/Drawer/src/useDrawer.ts index 6b6adabc..eced9aac 100644 --- a/src/components/Drawer/src/useDrawer.ts +++ b/src/components/Drawer/src/useDrawer.ts @@ -19,9 +19,9 @@ export function useDrawer(): UseDrawerReturnType { const drawer = ref<DrawerInstance | null>(null) const loaded = ref<Nullable<boolean>>(false) - const uid = ref<string>('') + const uid = ref<number>(0) - function register(drawerInstance: DrawerInstance, uuid: string) { + function register(drawerInstance: DrawerInstance, uuid: number) { isProdMode() && tryOnUnmounted(() => { drawer.value = null @@ -50,7 +50,7 @@ export function useDrawer(): UseDrawerReturnType { } const methods: ReturnMethods = { - setDrawerProps: (props: Partial<DrawerProps>): void => { + setDrawerProps: (props: Partial<DrawerProps>) => { getInstance()?.setDrawerProps(props) }, @@ -85,7 +85,7 @@ export function useDrawer(): UseDrawerReturnType { export function useDrawerInner(callbackFn?: Fn): UseDrawerInnerReturnType { const drawerInstanceRef = ref<Nullable<DrawerInstance>>(null) const currentInstance = getCurrentInstance() - const uidRef = ref<string>('') + const uidRef = ref<number>(0) if (!getCurrentInstance()) throw new Error('useDrawerInner() can only be used inside setup() or functional components!') @@ -99,7 +99,7 @@ export function useDrawerInner(callbackFn?: Fn): UseDrawerInnerReturnType { return instance } - const register = (modalInstance: DrawerInstance, uuid: string) => { + const register = (modalInstance: DrawerInstance, uuid: number) => { isProdMode() && tryOnUnmounted(() => { drawerInstanceRef.value = null diff --git a/src/components/Modal/src/components/ModalWrapper.vue b/src/components/Modal/src/components/ModalWrapper.vue index 0a1a7771..705d7c1b 100644 --- a/src/components/Modal/src/components/ModalWrapper.vue +++ b/src/components/Modal/src/components/ModalWrapper.vue @@ -30,7 +30,7 @@ let realHeight = 0 const stopElResizeFn: Fn = () => {} -useWindowSizeFn(setModalHeight.bind(false)) +useWindowSizeFn(setModalHeight.bind(null)) useMutationObserver( spinRef, diff --git a/src/components/Modal/src/hooks/useModal.ts b/src/components/Modal/src/hooks/useModal.ts index a510ccbd..9b7612aa 100644 --- a/src/components/Modal/src/hooks/useModal.ts +++ b/src/components/Modal/src/hooks/useModal.ts @@ -16,9 +16,9 @@ const openData = reactive<{ [key: number]: boolean }>({}) export function useModal(): UseModalReturnType { const modal = ref<Nullable<ModalMethods>>(null) const loaded = ref<Nullable<boolean>>(false) - const uid = ref<string>('') + const uid = ref<number>(0) - function register(modalMethod: ModalMethods, uuid: string) { + function register(modalMethod: ModalMethods, uuid: number) { if (!getCurrentInstance()) throw new Error('useModal() can only be used inside setup() or functional components!') @@ -88,7 +88,7 @@ export function useModal(): UseModalReturnType { export function useModalInner(callbackFn?: Fn): UseModalInnerReturnType { const modalInstanceRef = ref<Nullable<ModalMethods>>(null) const currentInstance = getCurrentInstance() - const uidRef = ref<string>('') + const uidRef = ref<number>(0) const getInstance = () => { const instance = unref(modalInstanceRef) @@ -98,7 +98,7 @@ export function useModalInner(callbackFn?: Fn): UseModalInnerReturnType { return instance } - const register = (modalInstance: ModalMethods, uuid: string) => { + const register = (modalInstance: ModalMethods, uuid: number) => { isProdMode() && tryOnUnmounted(() => { modalInstanceRef.value = null diff --git a/src/components/Modal/src/typing.ts b/src/components/Modal/src/typing.ts index 175222fd..9ffbbba7 100644 --- a/src/components/Modal/src/typing.ts +++ b/src/components/Modal/src/typing.ts @@ -10,7 +10,7 @@ export interface ModalMethods { redoModalHeight?: () => void } -export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void +export type RegisterFn = (modalMethods: ModalMethods, uuid: number) => void export interface ReturnMethods extends ModalMethods { openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void