CircleProgress
リング型プログレスコンポーネント:トラック円とプログレス弧は canvas 2d API で描画され(drawCircleTrack / drawCircleArc、share core で一元化、web とミニプログラムで同形)、テキストは絶対配置の view としてキャンバス上に重ねられます。タスクの進捗、ロード割合、スコア割合などのシーンで活躍します。
プラットフォーム差異(登録):本ポートは canvas 2d 形態です — ミニプログラムのテンプレートは SVG をサポートしない(share circle-progress の SVG スタイルは web ポート向け)ため、
<canvas type="2d">で share core の描画純関数をそのまま消費します;幾何(半径 / 掃引角 / 反時計回り換算)と色の正規化、テキスト整形はすべて share core を再利用し、ポート側は canvas コンテキストの取得と再描画のスケジューリングのみを行います。コンポーネントはイベントなし、完全に制御されます。
基本的な使い方
<template>
<lh-circle-progress :model-value="40" />
<lh-circle-progress :model-value="70" :size="140" :stroke-width="12" />
</template>カスタムカラーとグラデーション
color は単色文字列または色の配列を受け取ります;2 項目以上の配列は、配列順にグラデーション端点となる線形グラデーションになります。trackColor 省略時はトラック令牌のフォールバック色を使います:
<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 度、時計回りを正とします:
<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 修飾クラスが付きます):
<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(制御、範囲外は自動的に制限) | number | 0 |
| size | リングサイズ px(直径、キャンバスの幅と高さ) | number | 120 |
| strokeWidth | 線の太さ px | number | 6 |
| color | プログレス色:単色またはグラデーション配列(>=2 項目で線形グラデーション端点) | `string | string[]` |
| trackColor | トラック色(未指定時は令牌のフォールバック色) | string | 無効色のフォールバック |
| clockwise | 時計回り(false は反時計回りに描画) | boolean | true |
| startAngle | 開始角度(度、0 = 12 時方向、時計回りを正) | number | 0 |
| showText | デフォルトのパーセントテキストを表示 | boolean | true |
| format | テキストフォーマッタ(デフォルトは四捨五入パーセント) | (v: number) => string | — |
| linecap | 線の端点形状 | `'butt' | 'round' |
| label | アクセシビリティラベル | string | — |
| customClass | カスタムクラス(ルートノードに転送) | string | — |
| sx | sx レイアウト用プロップス | LhSxProps | — |
アクセシビリティ
ルートノードは role="progressbar" と aria-valuemin/max/now の値域セマンティクスを持ちます;label はアクセシブル名(例:「アップロード進捗」)を提供し、modelValue は 0-100 に制限された後に読み上げられます。

