File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-tippy" ,
3
- "version" : " 6.6 .0" ,
3
+ "version" : " 6.7 .0" ,
4
4
"main" : " index.js" ,
5
5
"module" : " dist/vue-tippy.mjs" ,
6
6
"unpkg" : " dist/vue-tippy.iife.js" ,
Original file line number Diff line number Diff line change @@ -24,8 +24,14 @@ tippy.setDefaultProps({
24
24
} ,
25
25
} )
26
26
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
+
27
33
export function useTippy (
28
- el : Element | ( ( ) => Element ) | Ref < Element > | Ref < Element | undefined > ,
34
+ el : TippyElement | ( ( ) => TippyElement ) | Ref < TippyElement > | Ref < TippyElement | undefined > ,
29
35
opts : TippyOptions = { } ,
30
36
settings : {
31
37
mount : boolean ,
@@ -231,9 +237,13 @@ export function useTippy(
231
237
232
238
if ( typeof target === 'function' ) target = target ( )
233
239
240
+ if ( isComponentInstance ( target ) ) {
241
+ target = target . $el as Element
242
+ }
243
+
234
244
if ( target ) {
235
245
//@ts -ignore
236
- instance . value = tippy ( target ?. $el ?? target , getProps ( opts ) )
246
+ instance . value = tippy ( target , getProps ( opts ) )
237
247
//@ts -ignore
238
248
target . $tippy = response
239
249
}
You can’t perform that action at this time.
0 commit comments