mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
parent
f3ffae9e54
commit
a939769069
@ -1,6 +1,6 @@
|
||||
---
|
||||
order: 0
|
||||
title:
|
||||
title:
|
||||
zh-CN: 基本
|
||||
en-US: Basic
|
||||
---
|
||||
@ -9,7 +9,7 @@ title:
|
||||
|
||||
最简单的用法。
|
||||
|
||||
## en-US
|
||||
## en-US
|
||||
|
||||
The simplest usage.
|
||||
|
||||
@ -18,7 +18,7 @@ import { Tooltip } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Tooltip title="prompt text">
|
||||
<span>Text will show when mouse enter.</span>
|
||||
<span>Tooltip will show when mouse enter.</span>
|
||||
</Tooltip>
|
||||
, mountNode);
|
||||
````
|
||||
|
@ -124,8 +124,9 @@ export default class Tooltip extends React.Component<TooltipProps, any> {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
const childrenProps = children.props;
|
||||
const childrenCls = classNames(childrenProps.className, {
|
||||
const child = React.isValidElement(children) ? children : <span>{children}</span>;
|
||||
const childProps = child.props;
|
||||
const childCls = classNames(childProps.className, {
|
||||
[openClassName || `${prefixCls}-open`]: true,
|
||||
});
|
||||
|
||||
@ -139,7 +140,7 @@ export default class Tooltip extends React.Component<TooltipProps, any> {
|
||||
onVisibleChange={this.onVisibleChange}
|
||||
onPopupAlign={this.onPopupAlign}
|
||||
>
|
||||
{visible ? cloneElement(children, { className: childrenCls }) : children}
|
||||
{visible ? cloneElement(child, { className: childCls }) : child}
|
||||
</RcTooltip>
|
||||
);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ exports[`test renders ./components/tooltip/demo/arrow-point-at-center.md correct
|
||||
|
||||
exports[`test renders ./components/tooltip/demo/basic.md correctly 1`] = `
|
||||
<span>
|
||||
Text will show when mouse enter.
|
||||
Tooltip will show when mouse enter.
|
||||
</span>
|
||||
`;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user