1
0
mirror of synced 2025-12-11 08:38:08 +08:00

tooltip修复报错问题

This commit is contained in:
xuliangzhan
2023-11-13 08:23:47 +08:00
parent bae0308c7d
commit ea95118ea9
3 changed files with 28 additions and 22 deletions

View File

@@ -242,31 +242,33 @@ export default defineComponent({
nextTick(() => {
const { trigger, content, modelValue } = props
const wrapperElem = refElem.value
const parentNode = wrapperElem.parentNode
if (parentNode) {
reactData.tipContent = content
reactData.tipZindex = nextZIndex()
XEUtils.arrayEach(wrapperElem.children, (elem, index) => {
if (index > 1) {
parentNode.insertBefore(elem, wrapperElem)
if (!reactData.target) {
reactData.target = elem as HTMLElement
if (wrapperElem) {
const parentNode = wrapperElem.parentNode
if (parentNode) {
reactData.tipContent = content
reactData.tipZindex = nextZIndex()
XEUtils.arrayEach(wrapperElem.children, (elem, index) => {
if (index > 1) {
parentNode.insertBefore(elem, wrapperElem)
if (!reactData.target) {
reactData.target = elem as HTMLElement
}
}
})
parentNode.removeChild(wrapperElem)
const { target } = reactData
if (target) {
if (trigger === 'hover') {
target.onmouseenter = targetMouseenterEvent
target.onmouseleave = targetMouseleaveEvent
} else if (trigger === 'click') {
target.onclick = clickEvent
}
}
})
parentNode.removeChild(wrapperElem)
const { target } = reactData
if (target) {
if (trigger === 'hover') {
target.onmouseenter = targetMouseenterEvent
target.onmouseleave = targetMouseleaveEvent
} else if (trigger === 'click') {
target.onclick = clickEvent
if (modelValue) {
tooltipMethods.open()
}
}
if (modelValue) {
tooltipMethods.open()
}
}
})
})