vue3列表渲染(v-for)_css

<script setup>
import { ref, onMounted, computed } from 'vue'
import './index.css'

const list = ref([
  {
    id: 0,
    text: 'apple',
  },
  {
    id: 1,
    text: 'orange',
  },
])

onMounted(() => {
  console.log(1)
})
</script>

<template>
  <div class="m-home-wrap">
    <div v-for="item in list" :key="item.id">{{ item.text }}</div>

    <div class="m-home-demo"></div>
  </div>
</template>

<style></style>

参考链接:

https://cn.vuejs.org/guide/essentials/list.html