diff --git a/components/spin/index.en-US.md b/components/spin/index.en-US.md index 782ac0ae51..aac43fc53f 100644 --- a/components/spin/index.en-US.md +++ b/components/spin/index.en-US.md @@ -18,3 +18,4 @@ size | size of spin, available in `small`, `default` and `large` | string | 'def spinning | whether Spin is spinning | boolean | true tip | customize description content when spin has children | string | - delay | specifies a delay millisecond for loading state (prevent flush) | number (millisecond) | - +wrapperClassName | className of wrapper when Spin has children | string | - diff --git a/components/spin/index.tsx b/components/spin/index.tsx index 88e3e0e78d..f2ed42ad84 100644 --- a/components/spin/index.tsx +++ b/components/spin/index.tsx @@ -13,6 +13,7 @@ export interface SpinProps { size?: 'small' | 'default' | 'large'; tip?: string; delay?: number; + wrapperClassName?: string; } export default class Spin extends React.Component { @@ -20,6 +21,7 @@ export default class Spin extends React.Component { prefixCls: 'ant-spin', spinning: true, size: 'default', + wrapperClassName: '', }; static propTypes = { @@ -27,6 +29,7 @@ export default class Spin extends React.Component { className: PropTypes.string, spinning: PropTypes.bool, size: PropTypes.oneOf(['small', 'default', 'large']), + wrapperClassName: PropTypes.string, }; debounceTimeout: number; @@ -82,7 +85,7 @@ export default class Spin extends React.Component { } } render() { - const { className, size, prefixCls, tip, ...restProps } = this.props; + const { className, size, prefixCls, tip, wrapperClassName, ...restProps } = this.props; const { spinning } = this.state; const spinClassName = classNames(prefixCls, { @@ -110,6 +113,10 @@ export default class Spin extends React.Component { ); if (this.isNestedPattern()) { + let animateClassName = prefixCls + '-nested-loading'; + if (wrapperClassName) { + animateClassName += ' ' + wrapperClassName; + } const containerClassName = classNames({ [`${prefixCls}-container`]: true, [`${prefixCls}-blur`]: spinning, @@ -118,7 +125,7 @@ export default class Spin extends React.Component { diff --git a/components/spin/index.zh-CN.md b/components/spin/index.zh-CN.md index 967671c8f9..887887a117 100644 --- a/components/spin/index.zh-CN.md +++ b/components/spin/index.zh-CN.md @@ -19,3 +19,4 @@ size | 组件大小,可选值为 `small` `default` `large` | string | 'default spinning | 是否旋转 | boolean | true tip | 当作为包裹元素时,可以自定义描述文案 | string | - delay | 延迟显示加载效果的时间(防止闪烁) | number (毫秒) | - +wrapperClassName | 包装器的类属性 | string | -