Make tip replace dot

This commit is contained in:
afc163 2016-02-21 14:48:14 +08:00
parent 3068ec357b
commit f7ba2969f6
2 changed files with 10 additions and 7 deletions

View File

@ -2,14 +2,18 @@
- order: 4
自定义描述文案。
自定义描述文案,指定的 tip 文案会直接代替 `...`
---
````jsx
import { Spin } from 'antd';
import { Spin, Alert } from 'antd';
ReactDOM.render(
<Spin tip="自定义描述文案"/>
<Spin tip="正在读取数据...">
<Alert message="消息提示的文案"
description="消息提示的辅助性文字介绍消息提示的辅助性文字介绍消息提示的辅助性文字介绍"
type="info" />
</Spin>
, mountNode);
````

View File

@ -6,13 +6,13 @@ const AntSpin = React.createClass({
getDefaultProps() {
return {
prefixCls: 'ant-spin',
spining: true
spining: true,
};
},
propTypes: {
className: React.PropTypes.string,
size: React.PropTypes.oneOf(['small', 'default', 'large'])
size: React.PropTypes.oneOf(['small', 'default', 'large']),
},
isNestedPattern() {
@ -31,13 +31,12 @@ const AntSpin = React.createClass({
});
let spinElement;
if (!isCssAnimationSupported) {
if (!isCssAnimationSupported || 'tip' in this.props) {
// not support for animation, just use text instead
spinElement = <div className={spinClassName}>{tip || '加载中...'}</div>;
} else {
spinElement = (
<div className={spinClassName}>
<div className={`${prefixCls}-tip`}>{tip}</div>
<div className={`${prefixCls}-dots`}>
<span className={`${prefixCls}-dot ${prefixCls}-dot-first`} />
<span className={`${prefixCls}-dot ${prefixCls}-dot-second`} />