diff --git a/components/progress/demo/line.md b/components/progress/demo/line.md index 97b49cca2a..ad51685c61 100644 --- a/components/progress/demo/line.md +++ b/components/progress/demo/line.md @@ -15,6 +15,7 @@ React.render( + , document.getElementById('components-progress-demo-line')); ```` diff --git a/components/progress/index.jsx b/components/progress/index.jsx index 0f7ad17b81..083311e7ee 100644 --- a/components/progress/index.jsx +++ b/components/progress/index.jsx @@ -11,11 +11,18 @@ const statusColorMap = { }; var Line = React.createClass({ + propTypes: { + status: React.PropTypes.oneOf(['normal', 'exception', 'active', 'success']), + showInfo: React.PropTypes.bool, + percent: React.PropTypes.number, + strokeWidth: React.PropTypes.number + }, getDefaultProps() { return { percent: 0, - strokeWidth: '10px', - status: 'normal' // exception + strokeWidth: 10, + status: 'normal', // exception active + showInfo: true }; }, render() { @@ -25,23 +32,27 @@ var Line = React.createClass({ props.status = 'success'; } - var progressInfo; - if (props.status === 'exception') { - progressInfo = ( - - - - ); - } else if (props.status === 'success') { - progressInfo = ( - - - - ); - } else { - progressInfo = ( - {props.percent}% - ); + var progressInfo, fullCls = ''; + if(props.showInfo === true){ + if (props.status === 'exception') { + progressInfo = ( + + + + ); + } else if (props.status === 'success') { + progressInfo = ( + + + + ); + } else { + progressInfo = ( + {props.percent}% + ); + } + }else { + fullCls = ' ' + prefixCls + '-line-wrap-full'; } var persentStyle = { width: props.percent + '%', @@ -49,7 +60,7 @@ var Line = React.createClass({ }; return ( -