mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-24 12:45:18 +08:00
refactor: use type directly from drawer in use-adjusted-to
This commit is contained in:
parent
5f1b1838cb
commit
7068e5b35f
@ -1,21 +1,18 @@
|
||||
import { useMemo } from 'vooks'
|
||||
import { ComponentPublicInstance, ComputedRef, inject } from 'vue'
|
||||
import type { ModalBodyInjection } from '../../modal/src/BodyWrapper'
|
||||
import type { DrawerBodyInjection } from '../../drawer/src/DrawerBodyWrapper'
|
||||
|
||||
interface UseAdjustedToProps {
|
||||
to?: string | HTMLElement
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
interface DrawerInjection {
|
||||
bodyRef: HTMLElement
|
||||
}
|
||||
|
||||
export function useAdjustedTo (
|
||||
props: UseAdjustedToProps
|
||||
): ComputedRef<HTMLElement | string> {
|
||||
const modal = inject<ModalBodyInjection | null>('NModalBody', null)
|
||||
const drawer = inject<DrawerInjection | null>('NDrawerBody', null)
|
||||
const drawer = inject<DrawerBodyInjection | null>('NDrawerBody', null)
|
||||
return useMemo(() => {
|
||||
const { to } = props
|
||||
if (to !== undefined) return to
|
||||
|
Loading…
Reference in New Issue
Block a user