1. <template>
    2. <div class="circle-box">
    3. <svg class="circular" viewBox="25 25 50 50">
    4. <circle :style="'stroke-dasharray: 126, 126;'" class="path2" cx="50" cy="50" r="20" fill="none"/>
    5. <circle :style="'stroke-dasharray: '+(num/100) * 126+', 126;'" class="path" cx="50" cy="50" r="20" fill="none"/>
    6. </svg>
    7. <div class="num">
    8. {{num}}%
    9. </div>
    10. </div>
    11. </template>
    12. <script>
    13. export default {
    14. props:{
    15. num:{
    16. type:Number,
    17. default:0
    18. }
    19. },
    20. data(){
    21. return{
    22. }
    23. }
    24. }
    25. </script>
    26. <style lang="less" scoped>
    27. .circular {
    28. width: 100%;
    29. height: auto;
    30. transform: rotate(-90deg);
    31. position: relative;
    32. }
    33. .path {
    34. animation: loading-dash 1.5s ease-in-out infinite;
    35. stroke-dashoffset: 0;
    36. stroke-width: 5;
    37. stroke: #bdb297;
    38. z-index: 99;
    39. transition: stroke-dasharray .5s;
    40. }
    41. .path2{
    42. stroke-dashoffset: 0;
    43. stroke-width: 5;
    44. stroke: #444445;
    45. }
    46. .num{
    47. position: absolute;
    48. top:0;
    49. width: 100%;
    50. height: 100%;
    51. display: flex;
    52. color: #bdb297;
    53. font-size: 32upx;
    54. align-items: center;
    55. justify-content: center;
    56. margin: auto;
    57. }
    58. .circle-box{
    59. position: relative;
    60. width: 100%;
    61. height: 100%;
    62. }
    63. </style>