forked from vueComponent/ant-design-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle-dynamic.vue
46 lines (38 loc) · 986 Bytes
/
circle-dynamic.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<docs>
---
order: 5
title:
zh-CN: 进度圈动态展示
en-US: Dynamic circular progress bar
---
## zh-CN
会动的进度条才是好进度条。
## en-US
A dynamic progress bar is better.
</docs>
<template>
<div>
<a-progress type="circle" :percent="defaultPercent" />
<a-button-group>
<a-button @click="decline">
<template #icon><minus-outlined /></template>
</a-button>
<a-button @click="increase">
<template #icon><plus-outlined /></template>
</a-button>
</a-button-group>
</div>
</template>
<script lang="ts" setup>
import { MinusOutlined, PlusOutlined } from '@ant-design/icons-vue';
import { ref } from 'vue';
const defaultPercent = ref<number>(0);
const increase = () => {
const percent = defaultPercent.value + 10;
defaultPercent.value = percent > 100 ? 100 : percent;
};
const decline = () => {
const percent = defaultPercent.value - 10;
defaultPercent.value = percent < 0 ? 0 : percent;
};
</script>