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