Tooltip: add hide-on-hover

pull/4319/head
Leopoldthecoder 2017-04-19 18:32:14 +08:00 committed by 杨奕
parent e7a610621f
commit 7883b16bef
3 changed files with 7 additions and 1 deletions

View File

@ -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 | | 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 | | 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 | — | — | | popper-class | custom class name for Tooltip's popper | string | — | — |
| enterable | whether the mouse can enter the tooltip | Boolean | — | true |

View File

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

View File

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