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;
  }
相关推荐
星云_byto4 小时前
CSS面试题
前端·css
科研邪修法12 小时前
PDF新增页面文字与文本批注怎么区分?以双版本培训讲义为例
前端·css·pdf
狮子座的男孩1 天前
html+css基础:31、响应式布局(媒体类型,媒体特性,运算符,常用阈值)
前端·css·经验分享·html·响应式布局·媒体类型/特性·常用阈值
狮子座的男孩1 天前
html+css基础:32、BFC(父子元素防止 margin 塌陷,父子元素清除浮动,兄弟元素两栏布局)
前端·css·经验分享·html·bfc·margin塌陷·清除浮动
吴长建先生2 天前
Flutter IM 即时聊天应用开发:从 0 到 1 实
css
htzyl2063 天前
前端样式-弹窗淡入淡出,为什么你的 `transition` 一直不生效
前端·css·html
Brookty3 天前
CSS基础知识(二):盒模型、内外边距、外边距折叠与父子元素的布局关系
前端·css
Mh4 天前
我是如何设计品牌站组件库的?
前端·css·设计模式
Brookty4 天前
CSS基础知识(一):选择器、优先级、层叠与继承、边框属性及盒模型
前端·css
htzyl2064 天前
CSS中,`:has()` 能帮你删掉的 4 类 JS
前端·css