scss同时使用两个数组
Posted 223zzm
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss同时使用两个数组相关的知识,希望对你有一定的参考价值。
<div class="content"> <div v-for="(item,index) in 5" :key="index" :class="`box box$index`"></div> </div>
<style lang=‘scss‘ scoped> .content position: relative; .box position: absolute; width: 50px; height: 50px; $color: red,green,blue,yellow,pink; $top: ‘0px‘ ‘50px‘ ‘100px‘ ‘150px‘ ‘200px‘; $left: ‘0px‘,‘50px‘,‘100px‘,‘150px‘,‘200px‘; // 遍历一个数组 @each $c in $color $i:index($color,$c); .box#$i - 1 background: nth($color,$i);; // 同时使用两个数组 @for $i from 1 to length($top) + 1 .box#$i - 1 top: #nth($top, $i); left: #nth($left, $i); </style>
以上是关于scss同时使用两个数组的主要内容,如果未能解决你的问题,请参考以下文章
ArrayIndexOutOfBoundsException,同时找到数组中两个连续元素之间的最大差异