Browse Source

Make tip replace dot

pull/1046/head
afc163 9 years ago
parent
commit
f7ba2969f6
  1. 10
      components/spin/demo/tip.md
  2. 7
      components/spin/index.jsx

10
components/spin/demo/tip.md

@ -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);
````

7
components/spin/index.jsx

@ -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`} />

Loading…
Cancel
Save