ul列表
<script setup>
import {ref,reactive}from 'vue'
let items=reactive([{
id:'item1',
message:"薯片"
},
{
id:'item2',
message:"可乐"
}])
</script>
<template>
<div>
<ul>
<li v-for='item in items' :key='item.id'>
{{ item.message }}
</li>
</ul>
</div>
</template>
<style scoped>
</style>
table表格
<script setup>
import {ref,reactive}from 'vue'
let items=reactive([{
id:'item1',
name:'urf'
},
{
id:'item2',
name:'read'
}])
</script>
<template>
<div>
<table>
<thead>
<tr>
<th>序号</th>
<th>姓名</th>
</tr>
</thead>
<tbody>
<tr v-for="item,index in items" :key="item.id">
<th>{{ index+1 }}</th>
<th>{{ item.name }}</th>
</tr>
</tbody>
</table>
</div>
</template>
<style scoped>
</style>