mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
fix #2258 for Badge
Spin
This commit is contained in:
parent
60f658c8ea
commit
fe4dfa05b0
@ -1,6 +1,7 @@
|
||||
import React, { createElement } from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
|
||||
import omit from 'object.omit';
|
||||
|
||||
function getNumberArray(num) {
|
||||
return num ?
|
||||
@ -122,12 +123,18 @@ export default class ScrollNumber extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { component, prefixCls, className, ...otherProps } = this.props;
|
||||
// fix https://fb.me/react-unknown-prop
|
||||
const restProps = omit(otherProps, [
|
||||
'count',
|
||||
'onAnimated',
|
||||
]);
|
||||
const props = {
|
||||
...this.props,
|
||||
className: `${this.props.prefixCls} ${this.props.className}`,
|
||||
...restProps,
|
||||
className: `${prefixCls} ${className}`,
|
||||
};
|
||||
return createElement(
|
||||
this.props.component,
|
||||
component,
|
||||
props,
|
||||
this.renderNumberElement()
|
||||
);
|
||||
|
@ -21,8 +21,7 @@ export default class Badge extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let { count, prefixCls, overflowCount, className, style, children } = this.props;
|
||||
const dot = this.props.dot;
|
||||
let { count, prefixCls, overflowCount, className, style, children, dot, ...restProps } = this.props;
|
||||
|
||||
count = count > overflowCount ? `${overflowCount}+` : count;
|
||||
|
||||
@ -41,7 +40,7 @@ export default class Badge extends React.Component {
|
||||
});
|
||||
|
||||
return (
|
||||
<span className={badgeCls} title={count} {...this.props} style={null}>
|
||||
<span className={badgeCls} title={count} {...restProps} style={null}>
|
||||
{children}
|
||||
<Animate component=""
|
||||
showProp="data-show"
|
||||
|
@ -3,6 +3,7 @@ import { findDOMNode } from 'react-dom';
|
||||
import classNames from 'classnames';
|
||||
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
|
||||
import warning from 'warning';
|
||||
import omit from 'object.omit';
|
||||
|
||||
export default class Spin extends React.Component {
|
||||
static defaultProps = {
|
||||
@ -75,8 +76,13 @@ export default class Spin extends React.Component {
|
||||
[className]: !!className,
|
||||
});
|
||||
|
||||
// fix https://fb.me/react-unknown-prop
|
||||
const divProps = omit(restProps, [
|
||||
'spinning',
|
||||
]);
|
||||
|
||||
const spinElement = (
|
||||
<div {...restProps} className={spinClassName}>
|
||||
<div {...divProps} className={spinClassName}>
|
||||
<span className={`${prefixCls}-dot`} />
|
||||
<div className={`${prefixCls}-text`}>{tip || '加载中...'}</div>
|
||||
</div>
|
||||
@ -84,7 +90,7 @@ export default class Spin extends React.Component {
|
||||
|
||||
if (this.isNestedPattern()) {
|
||||
return (
|
||||
<div {...restProps} className={spinning ? (`${prefixCls}-nested-loading`) : ''}>
|
||||
<div {...divProps} className={spinning ? (`${prefixCls}-nested-loading`) : ''}>
|
||||
{spinElement}
|
||||
<div className={`${prefixCls}-container`}>
|
||||
{this.props.children}
|
||||
|
Loading…
Reference in New Issue
Block a user