mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
Fix onVisibleChange, close #2134
This commit is contained in:
parent
2be285d236
commit
b5b9175e1e
@ -9,7 +9,7 @@ title: 基本
|
||||
import { Tooltip } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Tooltip title="提示文字">
|
||||
<Tooltip title="提示文字" onVisibleChange={visible => console.log(visible)}>
|
||||
<span>鼠标移上来就会出现提示</span>
|
||||
</Tooltip>
|
||||
, mountNode);
|
||||
|
@ -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 (
|
||||
<RcTooltip
|
||||
{...this.props}
|
||||
transitionName={transitionName}
|
||||
builtinPlacements={placements}
|
||||
overlay={title}
|
||||
@ -83,7 +86,6 @@ export default class Tooltip extends React.Component {
|
||||
onVisibleChange={this.onVisibleChange}
|
||||
onPopupAlign={this.onPopupAlign}
|
||||
ref="tooltip"
|
||||
{...this.props}
|
||||
>
|
||||
{visible ? cloneElement(children, { className: childrenCls }) : children}
|
||||
</RcTooltip>
|
||||
|
Loading…
Reference in New Issue
Block a user