Skip to content

Commit 41340a0

Browse files
committed
v6.7.0
1 parent daf61cb commit 41340a0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-tippy",
3-
"version": "6.6.0",
3+
"version": "6.7.0",
44
"main": "index.js",
55
"module": "dist/vue-tippy.mjs",
66
"unpkg": "dist/vue-tippy.iife.js",

src/composables/useTippy.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ tippy.setDefaultProps({
2424
},
2525
})
2626

27+
const isComponentInstance = (value: any): value is { $el: any } => {
28+
return value instanceof Object && '$' in value && '$el' in value
29+
}
30+
31+
type TippyElement = Element | any // TODO: use ComponentPublicInstance
32+
2733
export function useTippy(
28-
el: Element | (() => Element) | Ref<Element> | Ref<Element | undefined>,
34+
el: TippyElement | (() => TippyElement) | Ref<TippyElement> | Ref<TippyElement | undefined>,
2935
opts: TippyOptions = {},
3036
settings: {
3137
mount: boolean,
@@ -231,9 +237,13 @@ export function useTippy(
231237

232238
if (typeof target === 'function') target = target()
233239

240+
if (isComponentInstance(target)) {
241+
target = target.$el as Element
242+
}
243+
234244
if (target) {
235245
//@ts-ignore
236-
instance.value = tippy(target?.$el ?? target, getProps(opts))
246+
instance.value = tippy(target, getProps(opts))
237247
//@ts-ignore
238248
target.$tippy = response
239249
}

0 commit comments

Comments
 (0)