<template>
<div id="app">
<div class="chart-m-l-c">
<h3 class="jryy">维修设备台数</h3>
<div class="count">
<b v-for="(item, index) in prosecutorArr" :key="index">
<div :style="{ top: -item * 40 + 'px' }">
<i v-for="(ic, indexc) in 10" :key="indexc">{{ ic - 1 }}</i>
</div>
</b>
</div>
</div>
</div>
</template>
<script>
export default {
name: "you",
data() {
return {
prosecutorArr: ["0", "0", "0", "0", "0"],
numbers: "59832",
};
},
methods: {
PrefixInteger(num, length) {
return (Array(length).join("0") + num).slice(-length);
},
getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
},
plusNPrAll() {
const res = this.PrefixInteger(this.numbers, 5);
this.prosecutorArr = res.toString().split("");
},
refreshLeft() {
this.numbers = parseInt(this.numbers) + this.getRandomNumber(1, 100);
this.plusNPrAll();
},
},
mounted() {
this.plusNPrAll();
setInterval(() => {
this.numbers--;
this.plusNPrAll();
}, 2000);
},
};
</script>
<style lang="scss" scoped>
* {
margin: 0;
padding: 0;
list-style: none;
}
.chart-m-l-c {
width: 100%;
height: 60px;
padding: 10px 0;
float: left;
.jryy {
font-size: 21px;
color: green;
margin-left: 10px;
}
label {
line-height: 40px;
float: left;
font-size: 13px;
font-weight: 600;
}
.count {
height: 60px;
float: left;
padding: 0 5px;
b {
width: 30px;
height: 50px;
float: left;
border: 1px solid green;
border-radius: 15px;
color: green;
text-align: center;
line-height: 50px;
margin: 0 2px;
position: relative;
z-index: 3;
overflow: hidden;
div {
width: 100%;
height: 400px;
position: absolute;
left: 0;
top: 0;
transition: all 0.8s ease-in-out;
i {
width: 100%;
height: 40px;
float: left;
font-style: normal;
font-size: 28px;
color: green;
}
}
}
}
span {
line-height: 40px;
float: left;
}
span.iconfont {
width: 40px;
height: 40px;
line-height: 40px;
float: right;
text-align: center;
cursor: pointer;
color: #0071ff;
}
span.iconfont:hover {
color: #5ec2a6;
}
}
</style>