mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
commit
899f1e416e
19
components/spin/demo/tip.md
Normal file
19
components/spin/demo/tip.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 自定义描述文案
|
||||||
|
|
||||||
|
- order: 4
|
||||||
|
|
||||||
|
自定义描述文案,指定的 tip 文案会直接代替 `...`。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import { Spin, Alert } from 'antd';
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<Spin tip="正在读取数据...">
|
||||||
|
<Alert message="消息提示的文案"
|
||||||
|
description="消息提示的辅助性文字介绍消息提示的辅助性文字介绍消息提示的辅助性文字介绍"
|
||||||
|
type="info" />
|
||||||
|
</Spin>
|
||||||
|
, mountNode);
|
||||||
|
````
|
@ -6,13 +6,13 @@ const AntSpin = React.createClass({
|
|||||||
getDefaultProps() {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
prefixCls: 'ant-spin',
|
prefixCls: 'ant-spin',
|
||||||
spining: true
|
spining: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
size: React.PropTypes.oneOf(['small', 'default', 'large'])
|
size: React.PropTypes.oneOf(['small', 'default', 'large']),
|
||||||
},
|
},
|
||||||
|
|
||||||
isNestedPattern() {
|
isNestedPattern() {
|
||||||
@ -20,7 +20,7 @@ const AntSpin = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { className, size, prefixCls } = this.props;
|
const { className, size, prefixCls, tip } = this.props;
|
||||||
|
|
||||||
let spinClassName = classNames({
|
let spinClassName = classNames({
|
||||||
[prefixCls]: true,
|
[prefixCls]: true,
|
||||||
@ -31,9 +31,9 @@ const AntSpin = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
let spinElement;
|
let spinElement;
|
||||||
if (!isCssAnimationSupported) {
|
if (!isCssAnimationSupported || 'tip' in this.props) {
|
||||||
// not support for animation, just use text instead
|
// not support for animation, just use text instead
|
||||||
spinElement = <div className={spinClassName}>加载中...</div>;
|
spinElement = <div className={spinClassName}>{tip || '加载中...'}</div>;
|
||||||
} else {
|
} else {
|
||||||
spinElement = (
|
spinElement = (
|
||||||
<div className={spinClassName}>
|
<div className={spinClassName}>
|
||||||
|
@ -19,3 +19,4 @@
|
|||||||
|------------|----------------|-------------|--------------|
|
|------------|----------------|-------------|--------------|
|
||||||
| size | enum | default | spin组件中点的大小,可选值为 small default large |
|
| size | enum | default | spin组件中点的大小,可选值为 small default large |
|
||||||
| spining | boolean | true | 用于内嵌其他组件的模式,可以关闭 loading 效果 |
|
| spining | boolean | true | 用于内嵌其他组件的模式,可以关闭 loading 效果 |
|
||||||
|
| tip | string | 无 | 自定义描述文案 |
|
||||||
|
@ -51,6 +51,12 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tip
|
||||||
|
// ------------------------------
|
||||||
|
&-tip {
|
||||||
|
color: @spin-dot-default;
|
||||||
|
}
|
||||||
|
|
||||||
// dots
|
// dots
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user