← 应用组件

动态效果 · 加载与状态 · 状态 · 加载

环形进度

Ring progress

圆环描边平滑走到指定百分比

原理
一个圆用 stroke-dasharray 表示整圈长度,stroke-dashoffset 表示已走部分;改 offset 加过渡即可平滑推进,中心数字同步更新。
适用场景
上传、同步、仪表盘、资源加载
手感
利落 / 科技
状态 · 加载打开演示

参数

目标百分比percent · ratio · %68范围 0 ~ 100
圆环半径radius · number · px46范围 30 ~ 54

质量要求

  • 减少动态:不播放推进,直接显示目标百分比
  • 移动端:尺寸按容器缩,数字与圆环等比
  • 无 JS 兜底:没有脚本时显示 0% 的空环,不显示错误值

出处与许可

类型:自研实现 · 自研实现,stroke-dashoffset 加过渡

提示词
请在我的项目里做「环形进度」(Ring progress):圆环描边平滑走到目标百分比,中心数字同步。 参数:目标百分比 68%,半径 46px。 要求:保留原有尺寸与布局;开启“减少动态”直接显示目标值;脚本未执行时显示空环而不是错误数字。 参考:https://sdjc.xysai.top/web-components/progress-ring.md(原理、参数和参考代码)
185 字符
<div class="wc-progress">
  <div class="wc-ring" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
    <svg viewBox="0 0 120 120" aria-hidden="true">
      <circle class="wc-ring-track" cx="60" cy="60" r="46"></circle>
      <circle class="wc-ring-value" cx="60" cy="60" r="46"></circle>
    </svg>
    <div class="wc-ring-center"><span class="wc-ring-num">0%</span><small>已整理</small></div>
  </div>
  <div class="wc-progress-info">
    <span class="wc-progress-kicker">正在同步</span>
    <h3>60 条组件</h3>
    <p>38 条已就位,22 条还在路上。</p>
    <div class="wc-progress-steps"><span class="is-on"></span><span class="is-on"></span><span class="is-on"></span><span class="is-on"></span><span></span><span></span></div>
  </div>
</div>

相关组件