v6.7.0
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-tippy",
|
"name": "vue-tippy",
|
||||||
"version": "6.6.0",
|
"version": "6.7.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/vue-tippy.mjs",
|
"module": "dist/vue-tippy.mjs",
|
||||||
"unpkg": "dist/vue-tippy.iife.js",
|
"unpkg": "dist/vue-tippy.iife.js",
|
||||||
|
|||||||
@@ -24,8 +24,14 @@ tippy.setDefaultProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isComponentInstance = (value: any): value is { $el: any } => {
|
||||||
|
return value instanceof Object && '$' in value && '$el' in value
|
||||||
|
}
|
||||||
|
|
||||||
|
type TippyElement = Element | any // TODO: use ComponentPublicInstance
|
||||||
|
|
||||||
export function useTippy(
|
export function useTippy(
|
||||||
el: Element | (() => Element) | Ref<Element> | Ref<Element | undefined>,
|
el: TippyElement | (() => TippyElement) | Ref<TippyElement> | Ref<TippyElement | undefined>,
|
||||||
opts: TippyOptions = {},
|
opts: TippyOptions = {},
|
||||||
settings: {
|
settings: {
|
||||||
mount: boolean,
|
mount: boolean,
|
||||||
@@ -231,9 +237,13 @@ export function useTippy(
|
|||||||
|
|
||||||
if (typeof target === 'function') target = target()
|
if (typeof target === 'function') target = target()
|
||||||
|
|
||||||
|
if (isComponentInstance(target)) {
|
||||||
|
target = target.$el as Element
|
||||||
|
}
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
instance.value = tippy(target?.$el ?? target, getProps(opts))
|
instance.value = tippy(target, getProps(opts))
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
target.$tippy = response
|
target.$tippy = response
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user