diff --git a/src/composables/useTippy.ts b/src/composables/useTippy.ts index 662b5d8..087306c 100644 --- a/src/composables/useTippy.ts +++ b/src/composables/useTippy.ts @@ -29,6 +29,7 @@ export function useTippy( mount: boolean } = { mount: true } ) { + const vm = getCurrentInstance() const instance = ref() let container: Element | null = null @@ -49,10 +50,21 @@ export function useTippy( : content if (isVNode(unwrappedContent)) { + if (vm) { + unwrappedContent.appContext = vm.appContext + } + render(unwrappedContent, getContainer()) newContent = () => getContainer() } else if (typeof unwrappedContent === 'object') { - render(h(unwrappedContent), getContainer()) + let comp = h(unwrappedContent) + + if (vm) { + comp.appContext = vm.appContext + } + + render(comp, getContainer()) + newContent = () => getContainer() } else { newContent = unwrappedContent @@ -169,8 +181,6 @@ export function useTippy( } if (settings.mount) { - const vm = getCurrentInstance() - if (vm) { if (vm.isMounted) { mount()