Browse Source

feat:update progress icon

pull/2003/head
cydiacen 5 years ago
parent
commit
576851da85
  1. 11
      components/progress/progress.jsx

11
components/progress/progress.jsx

@ -2,7 +2,10 @@ import classNames from 'classnames';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, initDefaultProps, getListeners } from '../_util/props-util'; import { getOptionProps, initDefaultProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Icon from '../icon'; import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import CheckOutlined from '@ant-design/icons-vue/CheckOutlined';
import CheckCircleFilled from '@ant-design/icons-vue/CheckCircleFilled';
import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled';
import Line from './line'; import Line from './line';
import Circle from './circle'; import Circle from './circle';
import { validProgress } from './utils'; import { validProgress } from './utils';
@ -66,7 +69,7 @@ export default {
let text; let text;
const textFormatter = const textFormatter =
format || this.$scopedSlots.format || (percentNumber => `${percentNumber}%`); format || this.$scopedSlots.format || (percentNumber => `${percentNumber}%`);
const iconType = type === 'circle' || type === 'dashboard' ? '' : '-circle'; const isLineType = type === 'line';
if ( if (
format || format ||
this.$scopedSlots.format || this.$scopedSlots.format ||
@ -74,9 +77,9 @@ export default {
) { ) {
text = textFormatter(validProgress(percent), validProgress(successPercent)); text = textFormatter(validProgress(percent), validProgress(successPercent));
} else if (progressStatus === 'exception') { } else if (progressStatus === 'exception') {
text = <Icon type={`close${iconType}`} theme={type === 'line' ? 'filled' : 'outlined'} />; text = isLineType ? <CloseCircleFilled /> : <CloseOutlined />;
} else if (progressStatus === 'success') { } else if (progressStatus === 'success') {
text = <Icon type={`check${iconType}`} theme={type === 'line' ? 'filled' : 'outlined'} />; text = isLineType ? <CheckCircleFilled /> : <CheckOutlined />;
} }
return ( return (
<span class={`${prefixCls}-text`} title={typeof text === 'string' ? text : undefined}> <span class={`${prefixCls}-text`} title={typeof text === 'string' ? text : undefined}>

Loading…
Cancel
Save