less栅格

<template>
  <div class="row">
    <div class="col-18">1</div>
    <div class="col-24">2</div>
    <div class="col-6">3</div>
    <div class="col-6">4</div>
    <div class="col-6">5</div>
    <div class="col-6">6</div>
  </div>
</template>

<script>
export default {}
</script>

<style lang="less" scoped>

.row{
    width: 1500px;
    display: flex;
    flex-wrap: wrap;
    border: 1px solid blue;
    box-sizing: border-box;
    div{
        box-sizing: border-box;
        border: 1px solid red;
    }
     .loop(@i) when (@i<=24){
         .col-@{i}{
           width:(1 / 24 * @i *100) * 1%;
         }
         .loop(@i + 1);
     }
     .loop(1);
}
</style>

 

posted @ 2022-03-28 11:04  zjxgdq  阅读(13)  评论(0编辑  收藏  举报