Explorar o código

Tooltip: add hide-on-hover

Leopoldthecoder %!s(int64=8) %!d(string=hai) anos
pai
achega
7883b16bef

+ 1 - 0
examples/docs/en-US/tooltip.md

@@ -212,3 +212,4 @@ Disabled form elements are not supported in tooltip, see more information at [MD
 | open-delay | delay of appearance, in millisecond | number | — | 0 |
 | manual | whether to control Tooltip manually. `mouseenter` and `mouseleave` won't have effects if set to `true` | boolean | — | false |
 |  popper-class  |  custom class name for Tooltip's popper | string | — | — |
+| enterable | whether the mouse can enter the tooltip | Boolean | — | true |

+ 1 - 0
examples/docs/zh-CN/tooltip.md

@@ -214,3 +214,4 @@ tooltip 内不支持 disabled form 元素,参考[MDN](https://developer.mozill
 | open-delay | 延迟出现,单位毫秒 | Number | — | 0 |
 | manual | 手动控制模式,设置为 true 后,mouseenter 和 mouseleave 事件将不会生效 | Boolean | — | false |
 | popper-class | 为 Tooltip 的 popper 添加类名 | String | — | — |
+| enterable | 鼠标是否可进入到 tooltip 中 | Boolean | — | true |

+ 5 - 1
packages/tooltip/src/main.js

@@ -35,6 +35,10 @@ export default {
           gpuAcceleration: false
         };
       }
+    },
+    enterable: {
+      type: Boolean,
+      default: true
     }
   },
 
@@ -107,7 +111,7 @@ export default {
     },
 
     handleClosePopper() {
-      if (this.expectedState || this.manual) return;
+      if (this.enterable && this.expectedState || this.manual) return;
       clearTimeout(this.timeout);
       this.showPopper = false;
     },