Skip to content

Commit

Permalink
Update Tooltip.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
RytisTarasevicius authored Jun 21, 2024
1 parent 1ffcb5d commit 280db1d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/Tooltip/Tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@
},
data() {
return {
mouseEntered: false,
timeoutId: undefined,
show: false,
};
},
methods: {
onMouseEnter() {
this.mouseEntered = true;
setTimeout(() => {
if (!this.mouseEntered) return;
if (this.timeoutId) clearTimeout(this.timeoutId)
this.timeoutId = setTimeout(() => {
this.show = true;
if (this.appendToBody) {
this.$nextTick(() => {
Expand All @@ -75,9 +74,8 @@
}, this.delay);
},
onMouseLeave() {
this.mouseEntered = false;
setTimeout(() => {
if (this.mouseEntered) return;
if (this.timeoutId) clearTimeout(this.timeoutId)
this.timeoutId = setTimeout(() => {
if (this.appendToBody) {
document.body.removeChild(this.$refs.label);
}
Expand Down

0 comments on commit 280db1d

Please sign in to comment.