mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
improvement(components): [tooltip] dom ref types (#18923)
This commit is contained in:
parent
300b58c548
commit
768f5999f8
@ -181,9 +181,9 @@ tooltip/animations
|
||||
### Exposes
|
||||
|
||||
| Name | Description | Type |
|
||||
| -------------------- | ----------------------------------------------------------------- | ------------------------------------------------- |
|
||||
| popperRef | el-popper component instance | ^[object]`Ref<PopperInstance \| null>` |
|
||||
| contentRef | el-tooltip-content component instance | ^[object]`Ref<TooltipContentInstance \| null>` |
|
||||
| -------------------- | ----------------------------------------------------------------- | --------------------------------------------------- |
|
||||
| popperRef | el-popper component instance | ^[object]`Ref<PopperInstance \| undefined>` |
|
||||
| contentRef | el-tooltip-content component instance | ^[object]`Ref<TooltipContentInstance \| undefined>` |
|
||||
| isFocusInsideContent | validate current focus event is trigger inside el-tooltip-content | ^[Function]`() => boolean \| undefined` |
|
||||
| updatePopper | update el-popper component instance | ^[Function]`() => void` |
|
||||
| onOpen | expose onOpen function to mange el-tooltip open state | ^[Function]`(event?: Event \| undefined) => void` |
|
||||
|
@ -51,6 +51,7 @@ import { ElPopperContent } from '@element-plus/components/popper'
|
||||
import ElTeleport from '@element-plus/components/teleport'
|
||||
import { TOOLTIP_INJECTION_KEY } from './constants'
|
||||
import { useTooltipContentProps } from './content'
|
||||
import type { PopperContentInstance } from '@element-plus/components/popper'
|
||||
|
||||
defineOptions({
|
||||
name: 'ElTooltipContent',
|
||||
@ -61,8 +62,8 @@ const props = defineProps(useTooltipContentProps)
|
||||
|
||||
const { selector } = usePopperContainerId()
|
||||
const ns = useNamespace('tooltip')
|
||||
// TODO any is temporary, replace with `InstanceType<typeof ElPopperContent> | null` later
|
||||
const contentRef = ref<any>(null)
|
||||
|
||||
const contentRef = ref<PopperContentInstance>()
|
||||
let stopHandle: ReturnType<typeof onClickOutside>
|
||||
const {
|
||||
controlled,
|
||||
|
@ -70,6 +70,7 @@ import { TOOLTIP_INJECTION_KEY } from './constants'
|
||||
import { tooltipEmits, useTooltipModelToggle, useTooltipProps } from './tooltip'
|
||||
import ElTooltipTrigger from './trigger.vue'
|
||||
import ElTooltipContent from './content.vue'
|
||||
import type { TooltipContentInstance } from './content'
|
||||
import type { PopperInstance } from '@element-plus/components/popper'
|
||||
|
||||
defineOptions({
|
||||
@ -83,8 +84,7 @@ usePopperContainer()
|
||||
|
||||
const id = useId()
|
||||
const popperRef = ref<PopperInstance>()
|
||||
// TODO any is temporary, replace with `TooltipContentInstance` later
|
||||
const contentRef = ref<any>()
|
||||
const contentRef = ref<TooltipContentInstance>()
|
||||
|
||||
const updatePopper = () => {
|
||||
const popperComponent = unref(popperRef)
|
||||
|
Loading…
Reference in New Issue
Block a user