From cd43b3803a4e6ea0da998b8779e39731a8f21d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0o=E5=BC=A0=E4=B8=8D=E6=AD=AAo0?= Date: Tue, 21 Jun 2022 15:16:37 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20progress=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E7=BB=84=E4=BB=B6=20=E6=96=B0=E5=A2=9E=E7=8E=AF?= =?UTF-8?q?=E5=BD=A2=E8=BF=9B=E5=BA=A6=E6=9D=A1=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #I5CB05 ISSUES CLOSED: #I5CB05 --- .../src/component/progress/index.less | 13 ++++ .../src/component/progress/index.vue | 73 ++++++++++++++++++- .../src/document/zh-CN/components/progress.md | 28 ++++++- 3 files changed, 111 insertions(+), 3 deletions(-) diff --git a/package/component/src/component/progress/index.less b/package/component/src/component/progress/index.less index b01d334a..9f883799 100644 --- a/package/component/src/component/progress/index.less +++ b/package/component/src/component/progress/index.less @@ -37,4 +37,17 @@ position: static; padding: 0 10px; color: #fff; +} +.lay-progress-circle { + position: relative; + display: inline-block; + width: 120px; + height: 120px; + text-align: center; +} +.lay-progress-circle__text { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); } \ No newline at end of file diff --git a/package/component/src/component/progress/index.vue b/package/component/src/component/progress/index.vue index 790d4a4c..43d24194 100644 --- a/package/component/src/component/progress/index.vue +++ b/package/component/src/component/progress/index.vue @@ -15,6 +15,7 @@ export interface LayProgressProps { size?: string; showText?: boolean; text?: string; + circle?: boolean; } const props = defineProps(); @@ -27,10 +28,78 @@ const styles = computed(() => { }, ]; }); + +const getStrokeDasharray = computed(() => { + let percent; + if (typeof props.percent == "string") { + percent = parseInt(props.percent); + } else { + percent = props.percent; + } + return `${percent * 31.4}` + "px 3140px"; +}); + +const getCircleColor = computed(() => { + let color; + switch (props.theme) { + case "red": + color = "#ff5722"; + break; + case "orange": + color = "#ffb800"; + break; + case "green": + color = "#009688"; + break; + case "cyan": + color = "#2f4056"; + break; + case "blue": + color = "#1e9fff"; + break; + case "black": + color = "#393d49"; + break; + case "gray": + color = "#fafafa"; + break; + default: + color = "var(--global-checked-color)"; + break; + } + color = props.color ? props.color : color; + return color; +}); + \ No newline at end of file diff --git a/package/document/src/document/zh-CN/components/progress.md b/package/document/src/document/zh-CN/components/progress.md index e48683bd..4126ea57 100644 --- a/package/document/src/document/zh-CN/components/progress.md +++ b/package/document/src/document/zh-CN/components/progress.md @@ -119,6 +119,31 @@ export default { ::: +::: title 环形进度条 +::: +::: demo + + + + +::: + ::: title Progress 属性 ::: @@ -131,7 +156,8 @@ export default { | size | 尺寸 | `big` | | text | 提示 | -- | | color | 颜色 | -- | -| showText | 展示描述 | -- | +| showText | 展示描述 | -- | +|circle | 环形进度条| 默认为 `false` | :::