From 5cdde84cf1418b5278e3c49010b00e22b93ad059 Mon Sep 17 00:00:00 2001 From: zyronon Date: Sun, 20 Aug 2023 00:11:59 +0800 Subject: [PATCH] save --- src/components/Tooltip.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Tooltip.vue b/src/components/Tooltip.vue index ba9906b3..8210a215 100644 --- a/src/components/Tooltip.vue +++ b/src/components/Tooltip.vue @@ -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 { } - this.showPop(e)} - onmouseleave={() => this.show = false} + this.showPop(e)} + onmouseleave={() => this.show = false} /> }