IWoTke 2021-05-19 16:51 采纳率: 96.7%
浏览 169
已结题

如何解决三个颜色循环一遍,可循环多次


<template>
  <div class="box1">
    <div class="box2" v-for="(item, index) in data_list" :key="index" :style="[spacing]" >
      <div class="box2_1" :class="top[index]" :key="index" ></div>
      <div class="box2_2">{{ item.date }}</div>
      <div class="box2_3 xx">{{ item.License_plate }}</div>
      <div class="box2_4 xx">{{ item.state }}</div>
      <div class="box2_5 xx">{{ item.park }}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    spacing: {},
    data_list: {
      type: Array,
    },
  },
  data() {
    return {
      top: ["top1", "top2", "top3"],
    };
  },
  methods: {
    fn1(){
      alert(66)
    }
  },
  created:{
  }
};
</script>
<style scoped>
.top1 {
  background: #FC4567;
}
.top2 {
  background: #C25EC4;
}
.top3 {
  background: #2F8DF4;
}

.box2 {
  /* width: 2.838542rem; */
  height: .260417rem;
  font-family: "微软雅黑";
  font-weight: bold;
  font-size: .083333rem;
  /* outline: rgb(7, 7, 7) .005208rem solid; */
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-left: .109375rem;
  /* padding-left: .010417rem; */
  
}
.box2_1 {
  width: .020833rem;
  height: .15625rem;
}
.box2_2 {
  margin-left: .036458rem;
}
.box2_1:nth-child(3) {
  background: #ff0000;
}
.xx {
  padding-left: .182292rem;
}
</style>
  • 写回答

7条回答 默认 最新

  • CSDN专家-Time 2021-05-19 23:41
    关注

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

问题事件

  • 系统已结题 8月23日
  • 已采纳回答 8月15日

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算