vue去掉循环数组中的最后一组的某个样式style/class

vue去掉循环数组中的最后一组的某个样式style/class

需求:要实现这样的排列

现状

发现,最后一个格子并没有跟下面绿色线对齐。

最后发现 是因为 每个格子都给了 margin-right:36px,影响到了最后一个格子

所以要 将最后一个格子的margin 属性去掉

html 复制代码
  <div v-for="(item, index) in exportData.slice(3, 8)" :key="index">
      <div class="devicePart rectImg defaultrectImg"
:class="index === exportData.slice(3, 8).length - 1 ? '' : 'murightPart'">
        <div class="deviceTitle">{{ item.name.slice(0, 2) }}</div>
           <div class="deviceTitle">{{ item.name.slice(2, 5) }}</div>
       </div>
     </div>
 </div>

css

css 复制代码
 .muPart {
    display: flex;
  }

  .murightPart {
    margin-right: 36px;
  }
相关推荐
深蓝电商API11 小时前
网页结构解析入门:HTML、CSS、JS 与爬虫的关系
javascript·css·html
Python私教14 小时前
React 19 如何优雅整合 Ant Design v5 与 Tailwind CSS v4
前端·css·react.js
汤姆Tom14 小时前
写这么多年CSS,都不知道什么是容器查询?
前端·css·面试
曦曜29214 小时前
聊聊前端静态页面的开发
css·html
向葭奔赴♡1 天前
CSS是什么?—— 网页的“化妆师”
前端·css
银安1 天前
CSS排版布局篇(4):浮动(float)、定位(position) 、层叠(Stacking)
前端·css
wsWmsw2 天前
[译] 浏览器里的 Liquid Glass:利用 CSS 和 SVG 实现折射
前端·css·svg
银安2 天前
CSS排版布局篇(2):文档流(Normal Flow)
前端·css
折翼的恶魔2 天前
前端学习之样式设计
前端·css·学习
街尾杂货店&2 天前
css word-spacing属性
前端·css