Эх сурвалжийг харах

Popover: fix: delayed popover appears after mouse left

laobubu 8 жил өмнө
parent
commit
c1ce7a21b9

+ 3 - 2
packages/popover/src/main.vue

@@ -109,16 +109,17 @@ export default {
       this.showPopper = false;
       this.showPopper = false;
     },
     },
     handleMouseEnter() {
     handleMouseEnter() {
+      clearTimeout(this._timer);
       if (this.openDelay) {
       if (this.openDelay) {
-        setTimeout(() => {
+        this._timer = setTimeout(() => {
           this.showPopper = true;
           this.showPopper = true;
         }, this.openDelay);
         }, this.openDelay);
       } else {
       } else {
         this.showPopper = true;
         this.showPopper = true;
       }
       }
-      clearTimeout(this._timer);
     },
     },
     handleMouseLeave() {
     handleMouseLeave() {
+      clearTimeout(this._timer);
       this._timer = setTimeout(() => {
       this._timer = setTimeout(() => {
         this.showPopper = false;
         this.showPopper = false;
       }, 200);
       }, 200);