Skip to content

Commit

Permalink
✨ ProgressRing 支持自定义颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
Aira-Sakuranomiya committed Feb 20, 2024
1 parent 47c868d commit e331dcf
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions components/Progress/ProgressRing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
--size: 28px;
/// 进度环边缘线条粗细。
--thickness: 3px;
/// 颜色。
color: c(accent);
}
}
Expand All @@ -88,26 +90,26 @@
--thickness: 0px !important; // 如果去掉 px 则会行为异常。
}
}
@media (prefers-reduced-motion: reduce) {
.layer-wrapper {
display: none;
+ .icon {
display: block;
}
}
}
.layer-wrapper {
@include square(100%);
animation: spinner 1568ms linear infinite;
+ .icon {
display: none;
color: c(accent);
color: currentColor;
scale: 1.5;
&,
:deep(*) {
@include square(100%);
Expand All @@ -118,7 +120,7 @@
.layer {
@include square(100%);
position: absolute;
border-color: c(accent);
border-color: currentColor;
opacity: 1;
animation: layer-fill-unfill-rotate 5332ms $layer-animation-options;
}
Expand Down Expand Up @@ -207,13 +209,13 @@
cy: var(--center);
r: var(--radius);
fill: transparent;
stroke: c(accent);
stroke: currentColor;
stroke-width: var(--thickness);
stroke-linecap: round;
stroke-dasharray: var(--dash-array);
stroke-dashoffset: calc(var(--dash-array) * (1 - var(--progress)));
}
&.to-determinate circle {
animation: to-determinate-scale 250ms $ease-out-smooth;
}
Expand Down Expand Up @@ -309,7 +311,7 @@
rotate: 5deg;
}
}
@keyframes to-determinate-scale {
from {
stroke-dashoffset: 0;
Expand Down

2 comments on commit e331dcf

@Cocoa-C
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好耶

@Aira-Sakuranomiya
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不是全局自定义颜色,这个是给开发者用的

Please sign in to comment.