uniapp纯CSS实现圆形进度条组件
    		       		warning:
    		            这篇文章距离上次修改已过447天,其中的内容可能已经有所变动。
    		        
        		                
                
<template>
  <view class="circle-progress">
    <view class="circle-progress__half" :style="{ backgroundColor: halfColor }"></view>
    <view class="circle-progress__half" :style="{ backgroundColor: halfColor }"></view>
  </view>
</template>
 
<script>
export default {
  props: {
    halfColor: {
      type: String,
      default: '#09BB07'
    }
  }
}
</script>
 
<style scoped>
.circle-progress {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
}
 
.circle-progress__half {
  position: absolute;
  top: 0;
  left: 0;
  width: 100px;
  height: 50px;
  background-color: #e5e5e5;
}
 
.circle-progress__half:first-child {
  transform: rotate(180deg);
}
 
.circle-progress__half:last-child {
  transform: rotate(0deg);
}
</style>这个代码实例展示了如何使用uniapp和Vue的props特性来创建一个可配置的圆形进度条组件。它使用了两个重叠的方块来模拟圆形进度条的外观,并允许使用者通过halfColor属性来设置进度条的颜色。这个例子简洁明了,并且可以作为创建更复杂圆形进度条组件的基础。
评论已关闭