v-for怎么便利二位数组

LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,
LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,
LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,
LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,
LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,
LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,
LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,LPL必胜,
<template>
  J是第一遍便利的数组
  <div v-for="(j, index) in arr" :key="index" style="width: 98%; margin-left: 1%">
    <div style="height: 50px" @click="DIANJI(index)">{{ j.data }}</div>
    <div>
      <n-table :bordered="true" :single-line="false" style="margin-bottom: 1%">
        <thead>
          <tr style="margin-top: 50px">
            <th>序号</th>
            <th width="50%">停车场</th>
            <th>今日交易额</th>
            <th>今日交易笔数</th>
          </tr>
        </thead>
        <tbody>
    这里面就需要用J.数组去便利下一个数组,拿到里面的内容
          <tr  v-show="activeIndex===index" v-for="(i, index) in j.state" :key="index">
            <td>{{ i.Identifier }}</td>
            <td>{{ i.paring }}</td>
            <td>{{ i.Monkey }}</td>
            <td :class="a">{{ i.Number }}</td>
          </tr>
          <tr>
            <td></td>
            <td>总计</td>
            <td>{{ j.sumMonkey }}</td>
            <td>{{ j.sumNumber }}</td>
          </tr>
        </tbody>
      </n-table>
    </div>
  </div>
</template>

 

<script>
import { defineComponent, onMounted, ref, onBeforeMount } from 'vue';

 

export default defineComponent({
  setup() {
    const a = ref(null);

 

    const arr = ref([
      {
        state: [
          { Identifier: '1', paring: '461医院', Monkey: '101', Number: '290' },
          { Identifier: '2', paring: '安华停车场', Monkey: '101', Number: '100' },
        ],
        sumMonkey: 101,
        data: '2021-12-1',
      },
      {
        state: [
          { Identifier: '3', paring: '巴黎春天停车场', Monkey: '101', Number: '500' },
          { Identifier: '4', paring: '北方停车场', Monkey: '101', Number: '1000' },
        ],
        sumMonkey: 10213121,
        sumNumber: 900,
        data: '2021-12-2',
      },
    ]);
    const list = ref([]);
    console.log(list);
    const YangShi = ref(true);
    onMounted(() => {
      for (let i = 0; i < arr.value.length; i++) {
        list.value.push(arr.value[i].state);
        console.log(arr.value[i].state);
        console.log(list.value);
      }
    });
 onBeforeMount(async()=>{
        console.log("*******onMounted******")
      })
    return {
      YangShi,
      a,
      arr,
      list,
      DIANJI(index) {
        YangShi.value = !YangShi.value;
        arr.value[index];
      },
    };
  },
});
</script>



<style scoped>
.body {
  background: red;
}
.cass {
  background: royalblue;
}
thead th {
  text-align: center;
}

 

tbody tr {
  text-align: center;
}

 

tbody td {
  text-align: center;
}

 

.nan {
  height: 100%;
}

 

.uau {
  height: 1px;
}
</style>
posted @ 2021-11-03 09:46  阿轩丶  阅读(47)  评论(0编辑  收藏  举报