forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTooltipWrapper.tsx
More file actions
24 lines (20 loc) · 766 Bytes
/
TooltipWrapper.tsx
File metadata and controls
24 lines (20 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { ElTooltip, ElTooltipProps } from "element-plus"
import { defineComponent, ref, useSlots } from "vue"
type Props = PartialPick<ElTooltipProps, 'placement' | 'effect' | 'trigger' | 'offset'> & {
usePopover?: boolean
}
const TooltipWrapper = defineComponent<Props>(props => {
const visible = ref(false)
return () => (
<ElTooltip
visible={props.usePopover && visible.value}
onUpdate:visible={v => visible.value = v}
placement={props.placement}
effect={props.effect}
offset={props.offset}
trigger={props.trigger}
v-slots={useSlots()}
/>
)
}, { props: ['effect', 'offset', 'placement', 'trigger', 'usePopover'] })
export default TooltipWrapper