mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
mini demo
This commit is contained in:
parent
dda240d09b
commit
2c58d5e1ce
27
components/progress/demo/circle-mini.md
Normal file
27
components/progress/demo/circle-mini.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Circle 用法
|
||||
|
||||
- order: 0
|
||||
|
||||
Progress Circle用法
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
var Circle = antd.Progress.Circle;
|
||||
|
||||
React.render(
|
||||
<div>
|
||||
<Circle percent="30" width="100" strokeWidth="4" />
|
||||
<Circle percent="70" width="100" strokeWidth="4" status="exception" />
|
||||
<Circle percent="100" width="100" strokeWidth="4" />
|
||||
</div>
|
||||
, document.getElementById('components-progress-demo-circle-mini'));
|
||||
````
|
||||
|
||||
<style>
|
||||
.ant-progress-circle-wrap,
|
||||
.ant-progress-line-wrap {
|
||||
margin-right: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
</style>
|
@ -11,9 +11,9 @@ var Circle = antd.Progress.Circle;
|
||||
|
||||
React.render(
|
||||
<div>
|
||||
<Circle percent="30" width="100" strokeWidth="4" />
|
||||
<Circle percent="70" width="100" strokeWidth="4" status="exception" />
|
||||
<Circle percent="100" width="100" strokeWidth="4" />
|
||||
<Circle percent="30" width="150" strokeWidth="4" />
|
||||
<Circle percent="70" width="150" strokeWidth="4" status="exception" />
|
||||
<Circle percent="100" width="150" strokeWidth="4" />
|
||||
</div>
|
||||
, document.getElementById('components-progress-demo-circle'));
|
||||
````
|
||||
|
19
components/progress/demo/line-mini.md
Normal file
19
components/progress/demo/line-mini.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Line 用法
|
||||
|
||||
- order: 0
|
||||
|
||||
Progress Line用法
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
var Line = antd.Progress.Line;
|
||||
|
||||
React.render(
|
||||
<div>
|
||||
<Line percent="30" width="170" strokeWidth="3" />
|
||||
<Line percent="70" width="170" strokeWidth="3" status="exception" />
|
||||
<Line percent="100" width="170" strokeWidth="3" />
|
||||
</div>
|
||||
, document.getElementById('components-progress-demo-line-mini'));
|
||||
````
|
@ -11,9 +11,9 @@ var Line = antd.Progress.Line;
|
||||
|
||||
React.render(
|
||||
<div>
|
||||
<Line percent="30" width="300" strokeWidth="4" />
|
||||
<Line percent="70" width="300" strokeWidth="4" status="exception" />
|
||||
<Line percent="100" width="300" strokeWidth="4" />
|
||||
<Line percent="30" width="300" strokeWidth="3" />
|
||||
<Line percent="70" width="300" strokeWidth="3" status="exception" />
|
||||
<Line percent="100" width="300" strokeWidth="3" />
|
||||
</div>
|
||||
, document.getElementById('components-progress-demo-line'));
|
||||
````
|
||||
|
@ -10,7 +10,7 @@ var Line = React.createClass({
|
||||
percent: 0,
|
||||
strokeWidth: 2,
|
||||
status: 'normal' // exception
|
||||
}
|
||||
};
|
||||
},
|
||||
render() {
|
||||
var statusColorMap = {
|
||||
@ -20,35 +20,35 @@ var Line = React.createClass({
|
||||
};
|
||||
|
||||
if (parseInt(this.props.percent) === 100) {
|
||||
this.props.status = 'success'
|
||||
this.props.status = 'success';
|
||||
}
|
||||
|
||||
var style = {
|
||||
'width': this.props.width
|
||||
}
|
||||
};
|
||||
var wrapStyle = {
|
||||
'font-size': this.props.width / 100 * this.props.strokeWidth
|
||||
}
|
||||
};
|
||||
var textStyle = {
|
||||
'color': statusColorMap[this.props.status]
|
||||
}
|
||||
var progressInfo
|
||||
};
|
||||
var progressInfo;
|
||||
if (this.props.status === 'exception') {
|
||||
progressInfo = (
|
||||
<span style={textStyle} className='ant-progress-line-text'>
|
||||
<i className='anticon anticon-exclamation-round'></i>
|
||||
</span>
|
||||
)
|
||||
);
|
||||
} else if(this.props.status === 'success'){
|
||||
progressInfo = (
|
||||
<span style={textStyle} className='ant-progress-line-text'>
|
||||
<i className='anticon anticon-check-round'></i>
|
||||
</span>
|
||||
)
|
||||
);
|
||||
}else {
|
||||
progressInfo = (
|
||||
<span className='ant-progress-line-text'>{this.props.percent}%</span>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
@ -69,7 +69,7 @@ var Circle = React.createClass({
|
||||
percent: 0,
|
||||
strokeWidth: 2,
|
||||
status: 'normal' // exception
|
||||
}
|
||||
};
|
||||
},
|
||||
render() {
|
||||
var statusColorMap = {
|
||||
@ -79,30 +79,30 @@ var Circle = React.createClass({
|
||||
};
|
||||
|
||||
if (parseInt(this.props.percent) === 100) {
|
||||
this.props.status = 'success'
|
||||
this.props.status = 'success';
|
||||
}
|
||||
|
||||
var style = {
|
||||
'width': this.props.width,
|
||||
'height': this.props.width
|
||||
}
|
||||
};
|
||||
var wrapStyle = {
|
||||
'font-size': this.props.width * 0.3
|
||||
}
|
||||
};
|
||||
var textStyle = {
|
||||
'color': statusColorMap[this.props.status]
|
||||
}
|
||||
var progressInfo
|
||||
};
|
||||
var progressInfo;
|
||||
if (this.props.status === 'exception') {
|
||||
progressInfo = (
|
||||
<span style={textStyle} className='ant-progress-circle-text'>
|
||||
<i className='anticon anticon-exclamation'></i>
|
||||
</span>
|
||||
)
|
||||
);
|
||||
}else {
|
||||
progressInfo = (
|
||||
<span className="ant-progress-circle-text">{this.props.percent}%</span>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------|----------------|----------|--------------|
|
||||
| perscent | 百分比 | number | 0 |
|
||||
| percent | 百分比 | number | 0 |
|
||||
| status | 状态,有两个值normal、exception | string | normal |
|
||||
| strokeWidth | 进度条线宽度,单位是进度条画布宽度的百分比 | number | 1 |
|
||||
| width | 必填,进度条画布宽度,单位px。这里没有提供height属性设置,Line型高度就是strokeWidth,Circle型高度等于width | number | null |
|
||||
|
Loading…
Reference in New Issue
Block a user