naive-ui/demo/documentation/components/progress/enUS/multipleCircle.md

71 lines
1.5 KiB
Markdown
Raw Normal View History

2019-10-18 16:45:40 +08:00
# Multiple Circle
2020-02-01 00:47:07 +08:00
Maybe your PM will need this.
You can show multiple circle in a single progress. Note that `circle-gap` and `stroke-width` is relative to 100(the svg's viewbox size is 100).
2019-10-18 16:45:40 +08:00
```html
2020-02-01 00:47:07 +08:00
<n-config-consumer>
<template v-slot="{ styleScheme }">
<n-progress
type="multiple-circle"
:stroke-width="6"
:circle-gap="0.5"
:percentage="[
percentage,
(percentage + 10) % 100,
(percentage + 20) % 100,
(percentage + 30) % 100]"
:color="[
styleScheme.infoColor,
styleScheme.successColor,
styleScheme.warningColor,
styleScheme.errorColor
]"
:rail-color="[
styleScheme.infoColor + '30',
styleScheme.successColor + '30',
styleScheme.warningColor + '30',
styleScheme.errorColor + '30'
]"
>
<div style="text-align: center;">
2020-02-04 14:23:39 +08:00
Circle Racing!
2020-02-01 00:47:07 +08:00
</div>
</n-progress>
</template>
</n-config-consumer>
<div>
<n-button @click="minus">
Minus 10%
</n-button>
<n-button @click="add">
Add 10%
</n-button>
</div>
2019-10-18 16:45:40 +08:00
```
```js
export default {
data () {
return {
percentage: 0
}
},
methods: {
add () {
this.percentage += 10
if (this.percentage > 100) this.percentage = 0
},
minus () {
this.percentage -= 10
if (this.percentage < 0) this.percentage = 100
}
}
}
2020-02-01 00:47:07 +08:00
```
```css
.n-progress {
margin: 0 8px 12px 0;
}
.n-button {
margin: 0 8px 12px 0;
}
2019-10-18 16:45:40 +08:00
```