示例图
实现:
<div class="box">
<div class="grid-content">
<div v-for="(item, index) in 40" :class="{'grid-reset': item % 2 !== 0 && item > nowNum/totalNum*40, 'grid-two': item % 2 === 0, 'grid-item': true}" :key="index"></div>
</div>
</div>
totalNum: 500,
nowNum: 100,
.box {
background-color: #00103f;
width: 300px;
height: 300px;
padding: 50px;
.grid-content {
display: flex;
width: 200px;
background-image: linear-gradient(to right, #0A89FA, #0aedff);
.grid-two {
background-color: #00103f;
}
.grid-reset {
background-color: #0A285E;
}
.grid-item {
width: 5px;
height: 15px;
}
}
}
OK