<div :style="{'--box-num':boxNum}" class="item_box"> </div>
data() {
return {
boxNum: 2
}
},
.item_box{
width: 100%;
background: red;
height: calc(100% / var(--box-num));
}
<div :style="{'--box-num':boxNum}" class="item_box"> </div>
data() {
return {
boxNum: 2
}
},
.item_box{
width: 100%;
background: red;
height: calc(100% / var(--box-num));
}