Skip to content

Circle

基础用法

html

<pa-circle :model-value="80" />

样式定制

html

<view>
  <pa-circle :model-value="progress" stroke-width="8" text="设置宽度" />
  <pa-circle :model-value="progress" color="#ff2b2b" text="设置颜色" />
  <pa-circle :model-value="progress" :clockwise="false" text="逆时针" />
  <pa-circle :model-value="progress" :size="150" text="设置大小" />
</view>
<view class="mt-15">
  <pa-button type="primary" @click="add">增加</pa-button>
  <pa-button type="danger" class="ml-15" @click="subtract">减少</pa-button>
</view>
ts

import { ref } from 'vue'

const STEP = 10
const progress = ref(80)

const add = () => {
  if (progress.value >= 100) return
  progress.value += STEP
}

const subtract = () => {
  if (progress.value <= 0) return
  progress.value -= STEP
}

Circle Props

参数说明类型默认值
modelValue目标进度number0
size圆环直径,单位pxnumber100
color进度条颜色string'#009c5d'
layerColor轨道颜色string'#fff'
text文字string-
strokeWidth进度条宽度,单位pxnumber | string4
clockwise是否顺时针booleantrue
speed动画速度(单位为 value/s)number50

Circle Event

事件名参数

Circle Slot

名称说明
default-

样式变量

名称默认值
--pa-circle-text-colorvar(--pa-color-black)
--pa-circle-font-weight500
--pa-circle-font-size14px
--pa-circle-text-line-height20px