Skip to content

CircleProgress ​

링형 진행률 컴포넌트: 트랙 원과 진행률 호는 canvas 2d API로 그려지며(share core에서 통일, 웹과 미니프로그램에서 동일 형태), 텍스트는 절대 위치 view로 캔버스 위에 겹쳐집니다. 작업 진행률, 로딩 비율, 점수 비율 등의 시나리오에 활용합니다.

플랫폼 차이(등록): 이 포트는 canvas 2d 형태입니다 — 미니프로그램 템플릿은 SVG를 지원하지 않고(share circle-progress의 SVG 스타일은 웹 포트 대상) <canvas type="2d">로 share core의 그리기 순수 함수를 그대로 소비합니다; 기하학(반지름 / 스윕 각도 / 반시계 방향 변환)과 색상 정규화, 텍스트 서식은 모두 share core를 재사용하며, 포트는 캔버스 컨텍스트 획득과 다시 그리기 스케줄링만 담당합니다. 컴포넌트는 이벤트가 없고 완전히 제어됩니다.

기본 사용법 ​

vue
<template>
  <lh-circle-progress :model-value="40" />
  <lh-circle-progress :model-value="70" :size="140" :stroke-width="12" />
</template>

사용자 정의 색상과 그라데이션 ​

color는 단일 색상 문자열 또는 색상 배열을 받습니다; 2개 이상의 배열은 배열 순서대로 선형 그라데이션 끝점이 됩니다.trackColor를 생략하면 트랙 토큰의 대체 색상을 사용합니다:

vue
<lh-circle-progress :model-value="70" color="#B87800" track-color="#F0EBE2" />
<lh-circle-progress :model-value="80" :color="['#2B4C7C', '#C4A35A']" />
<lh-circle-progress :model-value="80" :color="['#5B8C5A', '#C4A35A', '#B23A3A']" />

반시계 방향과 시작 각도 ​

clockwise는 기본값 true(시계 방향);startAngle은 12시 방향을 0도로 하고 시계 방향을 양수로 합니다:

vue
<lh-circle-progress :model-value="55" :clockwise="false" />
<lh-circle-progress :model-value="55" :start-angle="90" />
<lh-circle-progress :model-value="55" :start-angle="135" :clockwise="false" />

사용자 정의 텍스트 ​

기본 텍스트는 반올림된 백분율입니다;format이 서식을 덮어쓰고, 기본 slot이 텍스트 전체를 교체하며,showText=false는 텍스트를 숨깁니다(루트에 lh-circle-progress--no-text 수식어가 추가됩니다):

vue
<lh-circle-progress :model-value="42" :format="(v: number) => `${v} 점`" />
<lh-circle-progress :model-value="100">완료</lh-circle-progress>
<lh-circle-progress :model-value="30" :show-text="false" />

Props ​

Prop설명타입기본값
modelValue진행률 백분율 0-100(제어, 범위 초과 시 자동으로 제한)number0
size링 크기 px(지름, 캔버스 너비와 높이)number120
strokeWidth선 너비 pxnumber6
color진행률 색상: 단일 색상 또는 그라데이션 배열(>=2 항목이 선형 그라데이션 끝점)`stringstring[]`
trackColor트랙 색상(미지정 시 토큰 대체 색상)string비활성색 대체
clockwise시계 방향(false는 반시계 방향으로 그리기)booleantrue
startAngle시작 각도(도, 0 = 12시 방향, 시계 방향 양수)number0
showText기본 백분율 텍스트 표시booleantrue
format텍스트 포매터(기본값 반올림 백분율)(v: number) => string—
linecap선 끝 모양`'butt''round'
label접근성 라벨string—
customClass커스텀 클래스(루트 노드로 전달)string—
sxsx 레이아웃 프로퍼티LhSxProps—

접근성 ​

루트 노드는 role="progressbar"와 aria-valuemin/max/now 값역 의미론을 가집니다;label은 접근성 이름(예: "업로드 진행률")을 제공하며,modelValue는 0-100으로 제한된 뒤 안내됩니다.