|
|
@ -19,9 +19,9 @@ export function useDrawer(): UseDrawerReturnType { |
|
|
|
|
|
|
|
|
|
|
|
const drawer = ref<DrawerInstance | null>(null) |
|
|
|
const drawer = ref<DrawerInstance | null>(null) |
|
|
|
const loaded = ref<Nullable<boolean>>(false) |
|
|
|
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() |
|
|
|
isProdMode() |
|
|
|
&& tryOnUnmounted(() => { |
|
|
|
&& tryOnUnmounted(() => { |
|
|
|
drawer.value = null |
|
|
|
drawer.value = null |
|
|
@ -50,7 +50,7 @@ export function useDrawer(): UseDrawerReturnType { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const methods: ReturnMethods = { |
|
|
|
const methods: ReturnMethods = { |
|
|
|
setDrawerProps: (props: Partial<DrawerProps>): void => { |
|
|
|
setDrawerProps: (props: Partial<DrawerProps>) => { |
|
|
|
getInstance()?.setDrawerProps(props) |
|
|
|
getInstance()?.setDrawerProps(props) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -85,7 +85,7 @@ export function useDrawer(): UseDrawerReturnType { |
|
|
|
export function useDrawerInner(callbackFn?: Fn): UseDrawerInnerReturnType { |
|
|
|
export function useDrawerInner(callbackFn?: Fn): UseDrawerInnerReturnType { |
|
|
|
const drawerInstanceRef = ref<Nullable<DrawerInstance>>(null) |
|
|
|
const drawerInstanceRef = ref<Nullable<DrawerInstance>>(null) |
|
|
|
const currentInstance = getCurrentInstance() |
|
|
|
const currentInstance = getCurrentInstance() |
|
|
|
const uidRef = ref<string>('') |
|
|
|
const uidRef = ref<number>(0) |
|
|
|
|
|
|
|
|
|
|
|
if (!getCurrentInstance()) |
|
|
|
if (!getCurrentInstance()) |
|
|
|
throw new Error('useDrawerInner() can only be used inside setup() or functional components!') |
|
|
|
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 |
|
|
|
return instance |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const register = (modalInstance: DrawerInstance, uuid: string) => { |
|
|
|
const register = (modalInstance: DrawerInstance, uuid: number) => { |
|
|
|
isProdMode() |
|
|
|
isProdMode() |
|
|
|
&& tryOnUnmounted(() => { |
|
|
|
&& tryOnUnmounted(() => { |
|
|
|
drawerInstanceRef.value = null |
|
|
|
drawerInstanceRef.value = null |
|
|
|