# Progress 진행률 표시줄

작업 진행률 시각화입니다. 선형과 원형 두 가지 형태를 지원하며, 상태 색상, 맞춤 색상 함수와 텍스트 포맷을 지원합니다.

진행률 표시줄
<template>
  <div class="demo-col">
    <p class="demo-note">line 선형</p>
    <LhProgress :percentage="30" />
    <LhProgress :percentage="70" status="success" />
    <LhProgress :percentage="45" status="warning" />
    <LhProgress :percentage="20" status="danger" />
    <LhProgress :percentage="60" :stroke-width="20" :format="fmt" />
    <LhProgress :percentage="100" :show-text="false" />
    <p class="demo-note">circle 원형 (width는 캔버스 크기를, strokeWidth는 선 두께를 제어)</p>
    <div class="demo-row" style="gap: 32px; flex-wrap: wrap">
      <LhProgress type="circle" :percentage="75" />
      <LhProgress type="circle" :percentage="40" :width="120" :stroke-width="14" status="warning" />
      <LhProgress type="circle" :percentage="100" status="success" :format="fmt" />
    </div>
    <p class="demo-note">color은 문자열 또는 백분율에 따라 색상을 반환하는 함수</p>
    <LhProgress :percentage="percent" :color="colorFn" />
    <LhButton size="small" @click="bump">{{ percent >= 100 ? '재설정' : '+10' }}</LhButton>
  </div>
</template>

<script>
export default {
  data: () => ({
    percent: 30,
  }),
  methods: {
    fmt(p) {
      return `${p / 10}할`
    },
    colorFn(p) {
      if (p < 40) return 'var(--lh-danger-color)'
      if (p < 80) return 'var(--lh-warning-color)'
      return 'var(--lh-success-color)'
    },
    bump() {
      this.percent = this.percent >= 100 ? 0 : this.percent + 10
    },
  },
}
</script>

# Props

프로퍼티 설명 타입 기본값
percentage 진행률 백분율 0-100 (초과하면 자동으로 클램프됨) number —
type 유형 'line' \| 'circle' 'line'
status 상태 색상 'default' \| 'success' \| 'warning' \| 'danger' 'default'
color 진행률 표시줄 색상: 문자열 또는 백분율에 따라 색상을 반환하는 함수 string \| ((percentage: number) => string) —
strokeWidth 선 너비 px (line은 높이, circle은 선 두께) number —
width 원형 모드 캔버스 너비 px number —
showText 진행률 텍스트 표시 여부 boolean true
format 맞춤 텍스트 포맷 (percentage: number) => string —
sx sx 레이아웃 단축 속성 — —

Copyright © 2024-2026 FengMo WenXue