This commit is contained in:
zyronon
2023-08-20 00:11:59 +08:00
parent 17f72022c3
commit 5cdde84cf1

View File

@@ -22,10 +22,11 @@ export default {
let rect = e.target.getBoundingClientRect()
this.show = true
nextTick(() => {
let tip = this.$refs.tip.getBoundingClientRect()
let tip = this.$refs?.tip?.getBoundingClientRect()
if (!tip) return
if (rect.top < 50) {
this.$refs.tip.style.top = rect.top + tip.height - 10 + 'px'
}else {
} else {
this.$refs.tip.style.top = rect.top - tip.height - 10 + 'px'
}
let tipWidth = tip.width
@@ -48,9 +49,9 @@ export default {
}
</Transition>
</Teleport>
<Vnode ref='tip'
onmouseenter={(e) => this.showPop(e)}
onmouseleave={() => this.show = false}
<Vnode
onmouseenter={(e) => this.showPop(e)}
onmouseleave={() => this.show = false}
/>
</>
}