diff --git a/components/tooltip/demo/basic.md b/components/tooltip/demo/basic.md index 29eeea7de1..3bcb6c0ec7 100644 --- a/components/tooltip/demo/basic.md +++ b/components/tooltip/demo/basic.md @@ -9,7 +9,7 @@ title: 基本 import { Tooltip } from 'antd'; ReactDOM.render( - + console.log(visible)}> 鼠标移上来就会出现提示 , mountNode); diff --git a/components/tooltip/index.jsx b/components/tooltip/index.jsx index aacd356ebf..bf5bbb4cdc 100644 --- a/components/tooltip/index.jsx +++ b/components/tooltip/index.jsx @@ -13,6 +13,7 @@ export default class Tooltip extends React.Component { transitionName: 'zoom-big', mouseEnterDelay: 0.1, mouseLeaveDelay: 0.1, + onVisibleChange() {}, } constructor(props) { @@ -24,6 +25,7 @@ export default class Tooltip extends React.Component { onVisibleChange = (visible) => { this.setState({ visible }); + this.props.onVisibleChange(visible); } getPopupDomNode() { @@ -76,6 +78,7 @@ export default class Tooltip extends React.Component { ? `${children.props.className} ${openClassName}` : openClassName; return ( {visible ? cloneElement(children, { className: childrenCls }) : children}