clone vue appContext in useTippy

This commit is contained in:
Georges KABBOUCHI
2021-06-12 00:10:58 +03:00
parent 0ad06f7321
commit abc7ce75b0
+13 -3
View File
@@ -29,6 +29,7 @@ export function useTippy(
mount: boolean
} = { mount: true }
) {
const vm = getCurrentInstance()
const instance = ref<Instance>()
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()