Skip to content

圆形进度环 xCircleProgress ​


预览

介绍 ​

全端 x-skia-u 绘制圆环进度,不要官方 canvas。

平台兼容 ​

HarmonyH5andriodIOS小程序UTSUNIAPP-X SDKversion
☑☑☑️☑️☑️☑️4.76+1.1.18

文件路径 ​

ts

@/uni_modules/tmx-ui/components/x-circle-progress/x-circle-progress.uvue

使用 ​

ts

<x-circle-progress></x-circle-progress>

Props 属性 ​

名称说明类型默认值
size可以是px,rpx,纯数字符串。带 rpx 才换算,否则按 px
string"60"
lineWidth可以是px,rpx,纯数字符串。带 rpx 才换算,否则按 px
string"3"
startAngle起始角度,默认是0,正上方顺时针
number0
color圆环背景颜色,暗黑时取inputDarkColor
string"info"
activeColor当前激活的进度颜色,空值读取全局值。
string""
modelValue当前的值,以百分比为值0-100,等同 v-model
number30
labelFontSize中间文本字号
string"16"
labelUnit数字的单位。
string"%"
showLabel是否显示中间文本。
booleanfalse
labelColor中间文本的颜色。
string"#333333"
darkLabelColor中间文本的暗黑颜色。空值是取白色
string""
duration进度条动画的时间,单位ms。
number300
linearColor进度渐变,如 linear-gradient(to right, #FFEB3A, #4DEF8E),全端有效
string""

Events 事件 ​

名称参数说明

Slots 插槽 ​

名称说明数据
default默认文本插槽current: number

Ref 方法 ​

名称参数返回值说明

示例文件路径 ​

json

/pages/zhanshi/circle-progress

示例源码 ​

uvue
vue
<template>
	<!-- #ifdef MP-WEIXIN -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor" :front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">圆形进度环 xCircleProgress</x-text>
			<x-text  color="#999999" >样式灵活多变。全端 x-skia-u 绘制,渐变各端可用。</x-text>
		</x-sheet>
		<x-sheet>
			<view class="flex flex-row flex-row-center-center">
				<x-circle-progress :model-value="testValue"></x-circle-progress>
				<x-circle-progress lineWidth="6" activeColor="success" linear-color="linear-gradient(to right, #FFEB3A, #4DEF8E)" class="mx-16"
					:model-value="testValue"></x-circle-progress>
				<x-circle-progress class="mr-32" lineWidth="10" color="error" activeColor="danger"
					:model-value="testValue"></x-circle-progress>
					<x-circle-progress activeColor="warn" :model-value="testValue"></x-circle-progress>
			</view>
			<view class="flex flex-row mt-32  flex-row-center-center pb-8">
				<x-button @click="add">增加</x-button>
				<x-button color="error" class="mx-16" @click="sur">减少</x-button>
			</view>
		</x-sheet>
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b ">设置起始角度</x-text>
		</x-sheet>
		<x-sheet>
			<view class="flex flex-row flex-row-center-center">
				<x-circle-progress :start-angle="-90" lineWidth="20" size="100" :show-label="true"
					:model-value="testValue"></x-circle-progress>
				<x-circle-progress :start-angle="90" lineWidth="20" class="ml-32" size="100" :show-label="true" color="error"
					activeColor="danger" :model-value="testValue"></x-circle-progress>
			</view>
		
		</x-sheet>
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b ">尺寸,显示文本</x-text>
		</x-sheet>
		<x-sheet>
			<view class="flex flex-row flex-row-center-center">
				<x-circle-progress lineWidth="20" size="100" :show-label="true"
					:model-value="testValue"></x-circle-progress>
				<x-circle-progress lineWidth="20" class="ml-32" size="100" :show-label="true" color="error"
					activeColor="danger" :model-value="testValue"></x-circle-progress>
			</view>

		</x-sheet>

</template>

<script lang="ts" setup>
	const testValue = ref(50)
	const add = () => {
		let abs = testValue.value + 10;
		if (abs > 100) {
			abs = 100
		}
		testValue.value = abs
	}
	const sur = () => {
		let abs = testValue.value - 10;
		if (abs < 0) {
			abs = 0
		}
		testValue.value = abs
	}
</script>

<style lang="scss">

</style>
最近更新