🎨 refactor some code

This commit is contained in:
afc163 2019-04-08 22:48:34 +08:00
parent fbcc884b5b
commit ace93f1b42
No known key found for this signature in database
GPG Key ID: 5F00908D72002306

View File

@ -61,13 +61,17 @@ export default class Progress extends React.Component<ProgressProps> {
default: PropTypes.oneOf(['default', 'small']),
};
getProgressStatus() {
const { successPercent, percent = 0, status } = this.props;
const percentNumber = parseInt(
getPercentNumber() {
const { successPercent, percent = 0 } = this.props;
return parseInt(
successPercent !== undefined ? successPercent.toString() : percent.toString(),
10,
);
if (percentNumber >= 100 && ProgressStatuses.indexOf(status!) < 0) {
}
getProgressStatus() {
const { status } = this.props;
if (ProgressStatuses.indexOf(status!) < 0 && this.getPercentNumber() >= 100) {
return 'success';
}
return status || 'normal';