arc

扇形组件

属性 作用
start 起始度数
angle 角度
color 颜色

Demo

  1. <template>
  2. <div :style="{'width':diameter,'height':diameter}" style="align-items: center;justify-content: center;">
  3. <arc class="fill" :style="{'width':diameter,'height':diameter}" start="270" angle="360" color="#bdbdbd" ></arc>
  4. <arc class="fill" :style="{'width':diameter,'height':diameter}" start="270" :angle="percent/100*360" :color="circleColor" ></arc>
  5. <div :style="{'width':diameter-circleWidth,'height':diameter-circleWidth}" style="align-items: center;justify-content: center;">
  6. <arc class="fill" start="270" angle="360" color="#ffffff" ></arc>
  7. <text :style="{'color':circleColor,'font-size':fontSize}">{{percent}}%</text>
  8. </div>
  9. </div>
  10. </template>
  11. <style>
  12. .fill
  13. {
  14. position: absolute;
  15. left: 0;
  16. top:0;
  17. right:0;
  18. bottom: 0;
  19. }
  20. </style>
  21. <script>
  22. export default{
  23. props:{
  24. fontSize:{
  25. default :38
  26. },
  27. diameter:{
  28. default:120
  29. },
  30. circleWidth:
  31. {
  32. default:20
  33. },
  34. circleColor:
  35. {
  36. default:"#000000"
  37. },
  38. percent:{
  39. default:10
  40. }
  41. }
  42. }
  43. </script>