ant-design-vue/components/vc-progress/demo/gap.jsx

73 lines
1.7 KiB
Vue
Raw Normal View History

2019-01-12 11:33:27 +08:00
import { Circle } from '../index';
import '../assets/index.less';
2018-04-03 11:00:05 +08:00
export default {
2019-01-12 11:33:27 +08:00
data() {
2018-04-03 11:00:05 +08:00
return {
percent: 30,
color: '#3FC7FA',
2019-01-12 11:33:27 +08:00
};
2018-04-03 11:00:05 +08:00
},
methods: {
2019-01-12 11:33:27 +08:00
changeState() {
const colorMap = ['#3FC7FA', '#85D262', '#FE8C6A'];
const value = parseInt(Math.random() * 100, 10);
this.percent = value;
this.color = colorMap[parseInt(Math.random() * 3, 10)];
2018-04-03 11:00:05 +08:00
},
},
2019-01-12 11:33:27 +08:00
render() {
2018-04-03 11:00:05 +08:00
const circleContainerStyle = {
width: '200px',
height: '200px',
2019-01-12 11:33:27 +08:00
};
2018-04-03 11:00:05 +08:00
return (
<div>
<div style={circleContainerStyle}>
<Circle
percent={this.percent}
2019-01-12 11:33:27 +08:00
gapDegree="70"
gapPosition="top"
strokeWidth="6"
strokeLinecap="square"
2018-04-03 11:00:05 +08:00
strokeColor={this.color}
/>
</div>
<div style={circleContainerStyle}>
<Circle
percent={this.percent}
2019-01-12 11:33:27 +08:00
gapDegree="70"
gapPosition="bottom"
strokeWidth="6"
strokeLinecap="square"
2018-04-03 11:00:05 +08:00
strokeColor={this.color}
/>
</div>
<div style={circleContainerStyle}>
<Circle
percent={this.percent}
2019-01-12 11:33:27 +08:00
gapDegree="70"
gapPosition="left"
strokeWidth="6"
strokeLinecap="square"
2018-04-03 11:00:05 +08:00
strokeColor={this.color}
/>
</div>
<div style={circleContainerStyle}>
<Circle
percent={this.percent}
2019-01-12 11:33:27 +08:00
gapDegree="70"
gapPosition="right"
strokeWidth="6"
strokeLinecap="square"
2018-04-03 11:00:05 +08:00
strokeColor={this.color}
/>
</div>
<p>
<button onClick={this.changeState}>Change State</button>
</p>
</div>
2019-01-12 11:33:27 +08:00
);
2018-04-03 11:00:05 +08:00
},
2019-01-12 11:33:27 +08:00
};