【Vue】列表渲染

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>

相关推荐

  1. Vue列表渲染

    2024-01-20 05:36:01       53 阅读
  2. vue-列表渲染

    2024-01-20 05:36:01       44 阅读
  3. vue ---列表渲染

    2024-01-20 05:36:01       40 阅读
  4. Vue2学习笔记(列表渲染

    2024-01-20 05:36:01       50 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-20 05:36:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-20 05:36:01       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-20 05:36:01       82 阅读
  4. Python语言-面向对象

    2024-01-20 05:36:01       91 阅读

热门阅读

  1. 如何在指定的conda虚拟环境中启动Juptyter

    2024-01-20 05:36:01       54 阅读
  2. react中refs的作用是什么?有几种用法?

    2024-01-20 05:36:01       46 阅读
  3. c++算法之模拟

    2024-01-20 05:36:01       50 阅读
  4. 服务器与电脑的区别

    2024-01-20 05:36:01       55 阅读
  5. springcloud gateway正确路由配置 uri找不到服务?

    2024-01-20 05:36:01       52 阅读
  6. JVM实战(27)——内存溢出概述

    2024-01-20 05:36:01       62 阅读
  7. 前端图片转base64 方法

    2024-01-20 05:36:01       60 阅读
  8. 哥德巴赫猜想不成立

    2024-01-20 05:36:01       55 阅读
  9. 17.正则表达式

    2024-01-20 05:36:01       42 阅读
  10. 如何使用ThinkPHP框架(thinkphp8.0)创建定时任务?

    2024-01-20 05:36:01       54 阅读