<template>
<div class="circle-box">
<svg class="circular" viewBox="25 25 50 50">
<circle :style="'stroke-dasharray: 126, 126;'" class="path2" cx="50" cy="50" r="20" fill="none"/>
<circle :style="'stroke-dasharray: '+(num/100) * 126+', 126;'" class="path" cx="50" cy="50" r="20" fill="none"/>
</svg>
<div class="num">
{{num}}%
</div>
</div>
</template>
<script>
export default {
props:{
num:{
type:Number,
default:0
}
},
data(){
return{
}
}
}
</script>
<style lang="less" scoped>
.circular {
width: 100%;
height: auto;
transform: rotate(-90deg);
position: relative;
}
.path {
animation: loading-dash 1.5s ease-in-out infinite;
stroke-dashoffset: 0;
stroke-width: 5;
stroke: #bdb297;
z-index: 99;
transition: stroke-dasharray .5s;
}
.path2{
stroke-dashoffset: 0;
stroke-width: 5;
stroke: #444445;
}
.num{
position: absolute;
top:0;
width: 100%;
height: 100%;
display: flex;
color: #bdb297;
font-size: 32upx;
align-items: center;
justify-content: center;
margin: auto;
}
.circle-box{
position: relative;
width: 100%;
height: 100%;
}
</style>