zdppy+vue3+antd 实现表格数据渲染

基本用法

<template>
  <a-table :columns="columns" :data-source="data">
    <template #headerCell="{ column }">
      <template v-if="column.key === 'name'">
        <span>
          xxx Name
        </span>
      </template>
    </template>

    <template #bodyCell="{ column, record }">
      <template v-if="column.key === 'name'">
        <a>
          aaa {{ record.name }}
        </a>
      </template>

      <template v-else-if="column.key === 'tags'">
        <span>
          <a-tag
              v-for="tag in record.tags"
              :key="tag"
              :color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'"
          >
            {{ tag.toUpperCase() }}
          </a-tag>
        </span>
      </template>
      
      <template v-else-if="column.key === 'action'">
        <span>
          <a>Invite 一 {{ record.name }}</a>
          <a-divider type="vertical" />
          <a>Delete</a>
          <a-divider type="vertical" />
          <a class="ant-dropdown-link">
            More actions
          </a>
        </span>
      </template>
    </template>
  </a-table>
</template>
<script setup>
const columns = [
  {
    name: 'Name',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
  },
  {
    title: 'Tags',
    key: 'tags',
    dataIndex: 'tags',
  },
  {
    title: 'Action',
    key: 'action',
  },
];

const data = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
    tags: ['nice', 'developer'],
  },
  {
    key: '2',
    name: 'Jim Green',
    age: 42,
    address: 'London No. 1 Lake Park',
    tags: ['loser'],
  },
  {
    key: '3',
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
    tags: ['cool', 'teacher'],
  },
];
</script>

在这里插入图片描述

渲染用户数据


<script setup>
import {onMounted} from "vue";
import axios from "axios";

const columns = [
  {
    name: '姓名',
    dataIndex: 'name',
    key: 'name',
  },
  {
    name: '性别',
    dataIndex: 'gender',
    key: 'gender',
  },
  {
    title: '年龄',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: '电话',
    dataIndex: 'phone',
    key: 'phone',
  },
  {
    title: '邮箱',
    key: 'email',
    dataIndex: 'email',
  },
  {
    title: '薪资',
    key: 'salary',
    dataIndex: 'salary',
  },
  {
    title: '操作',
    key: 'action',
  },
];

const data = [
  {
    key: '1',
    name: 'John Brown',
    gender: "male",
    age: 32,
    phone: '18811112222',
    email: '18811112222@qq.com',
    salary: 33333,
  },
  {
    key: '2',
    name: 'John Brown',
    gender: "male",
    age: 32,
    phone: '18811112222',
    email: '18811112222@qq.com',
    salary: 33333,
  },
  {
    key: '3',
    name: 'John Brown',
    gender: "male",
    age: 32,
    phone: '18811112222',
    email: '18811112222@qq.com',
    salary: 33333,
  },
];

onMounted(()=>{
  axios.get("http://127.0.0.1:8889/zdppy_amuserdetail").then((response) => {
    console.log("response.data", response.data);
  })
})

</script>

<template>
  <a-table :columns="columns" :data-source="data">
    <template #headerCell="{ column }">
      <template v-if="column.key === 'name'">
        <span>
          {{ column.name }}
        </span>
      </template>
      <template v-else-if="column.key === 'gender'">
        <span>
          {{ column.name }}
        </span>
      </template>
    </template>

    <template #bodyCell="{ column, record }">
      <template v-if="column.key === 'action'">
        <a-space wrap>
          <a-button size="small" type="primary" block>编辑</a-button>
          <a-button size="small" block>详情</a-button>
          <a-button size="small" danger block>删除</a-button>
        </a-space>
      </template>
    </template>
  </a-table>
</template>

在这里插入图片描述

渲染后端用户列表数据


<script setup>
import {onMounted, ref} from "vue";
import axios from "axios";

const columns = [
  {
    name: '姓名',
    dataIndex: 'name',
    key: 'name',
  },
  {
    name: '性别',
    dataIndex: 'gender',
    key: 'gender',
  },
  {
    title: '年龄',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: '电话',
    dataIndex: 'phone',
    key: 'phone',
  },
  {
    title: '邮箱',
    key: 'email',
    dataIndex: 'email',
  },
  {
    title: '薪资',
    key: 'salary',
    dataIndex: 'salary',
  },
  {
    title: '操作',
    key: 'action',
  },
];

const data = ref([]);

onMounted(()=>{
  axios.get("http://127.0.0.1:8889/zdppy_amuserdetail").then((response) => {
    console.log("response.data", response.data);
    data.value = response.data.data;
  })
})

</script>

<template>
  <a-table :columns="columns" :data-source="data">
    <template #headerCell="{ column }">
      <template v-if="column.key === 'name'">
        <span>
          {{ column.name }}
        </span>
      </template>
      <template v-else-if="column.key === 'gender'">
        <span>
          {{ column.name }}
        </span>
      </template>
    </template>

    <template #bodyCell="{ column, record }">
      <template v-if="column.key === 'action'">
        <a-space wrap>
          <a-button size="small" type="primary" block>编辑</a-button>
          <a-button size="small" block>详情</a-button>
          <a-button size="small" danger block>删除</a-button>
        </a-space>
      </template>
    </template>
  </a-table>
</template>

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/776830.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

2024年中国陶瓷轴承用氮化硅粉体市场发展现状及重点竞争企业研究

2024年中国陶瓷轴承用氮化硅粉体市场发展现状及重点竞争企业研究 氮化硅是一种硬度高、结构稳定、热膨胀系数小&#xff0c;抗氧化和抗侵蚀性能好的一种的陶瓷材料&#xff0c;可用于制造高性能氮化硅陶瓷结构件、坩埚涂层等。近年来&#xff0c;伴随着机械制造行业进一步向高精…

Google重大更新--解读Android Auto认证4.3

Google在今年五月更新了Android Auto 4.2.2版本&#xff0c;而在2024年7月他们推出了Android Auto 4.3版本&#xff0c;这是自2023年9月以来对Android Auto 4.2版本的一次重大更新。 为了确保合规性和顺利认证&#xff0c;OEM和Tire1必须确保PDK组件版本与正在认证的主机的Rece…

昇思25天学习打卡营第18天 | 基于MobileNetv2的垃圾分类

内容介绍&#xff1a; MobileNet网络是由Google团队于2017年提出的专注于移动端、嵌入式或IoT设备的轻量级CNN网络&#xff0c;相比于传统的卷积神经网络&#xff0c;MobileNet网络使用深度可分离卷积&#xff08;Depthwise Separable Convolution&#xff09;的思想在准确率小…

Shopee(虾皮)怎么获取流量?

店铺流量的高低会直接关联到卖家店铺单量&#xff0c;也关系到一个店铺的营业情况和利润&#xff0c;那么Shopee的流量从哪里来呢&#xff1f; Shopee的平台流量可分为五个部分&#xff1a; 1.自然流量 2.关键字广告流量 3.平台活动流量 4.营销流量 5.粉丝流量 怎么提升…

nacos源码 nacos注册中心1.4.x 源码 nacos源码如何下载 nacos 客户端源码下载地址 nacos discovery下载地址(一)

首先&#xff0c;发现很多解读文章对核心点讲解的很多&#xff0c;但是我感觉没讲全&#xff0c;记录下&#xff0c;我自己看源码时候一些心得 1. 读源码第一步&#xff0c;先去github, issue, 官网&#xff1a; 1.1 github : https://github.com/alibaba/…

数据挖掘与分析——深度学习算法应用

1. TensorFlow框架的基本使用&#xff08;5-1&#xff09; 获取训练数据 构建一个简单的线性模型&#xff1a;W&#xff0c;b为参数&#xff0c;W2&#xff0c;b1&#xff0c;运用tf.random.normal() 产生1000个随机数&#xff0c;产生x,y数据。 用matplotlib库&#xff0c;…

android iconfont带图标的图文并茂的一种实现

android实现图文并茂方法很多。 这里针对&#xff0c;仅本地图标&#xff0c;需要对齐&#xff0c;任意位置&#xff0c;兼容换行导致后面空白的问题做的一种方案。 www.iconfont.cn&#xff0c;注册&#xff1b; 上传svg的icon&#xff1b; 下载项目得到iconfont.ttf&#xf…

文献阅读:通过高通量原位成对测序实现亚细胞分辨率的空间多组学

文献介绍 文献题目&#xff1a; Spatial multi-omics at subcellular resolution via high-throughput in situ pairwise sequencing 研究团队&#xff1a; 曹罡&#xff08;深圳理工大学&#xff09;、戴金霞&#xff08;华中农业大学&#xff09; 发表时间&#xff1a; 2024…

Nginx-http_limit_req_module模块

文章目录 前言一、ngx_http_limit_req_module模块二、指令1.limit_req_zone2.limit_req3.limit_req_log_level4.limit_req_status 实验burst取默认0的情况burst不取默认值 总结 前言 如何限制每个客户端每秒处理请求数 一、ngx_http_limit_req_module模块 生效阶段&#xff1…

node.js外卖小程序-计算机毕业设计源码81838

摘要 自从计算机发展开始&#xff0c;计算机软硬件相关技术的发展速度越来越快&#xff0c;在信息化高速发展的今天&#xff0c;计算机应用技术似乎已经应用到了各个领域。在餐饮行业&#xff0c;除了外卖以外就是到店里就餐&#xff0c;在店里就餐如果需要等待点餐的话&…

Vue的民族民俗文化分享平台-计算机毕业设计源码22552

基于Vue的民族民俗文化分享平台设计与实现 摘 要 本文介绍了一种基于Vue.js前端框架和Express后端框架的民族民俗文化分享平台的设计和实现。该平台旨在通过线上方式&#xff0c;促进民族民俗文化的传播与分享&#xff0c;增强公众对多元文化的了解和认同。 平台为普通用户提供…

谷粒商城学习笔记-14-项目结构创建提交到码云

一&#xff0c;码云上创建工程仓库 1&#xff0c;,点击右上角加号&#xff0c;选择新建仓库 2&#xff0c;填充必要信息 ①仓库名称&#xff0c;可以理解为工程名称。 ②仓库介绍&#xff0c;添加关于仓库的说明。 ③仓库权限设置&#xff0c;如果是公司项目&#xff0c;一般…

跨境电商入场第一步!先收集整理这些数据,看清自己该如何入场!【纯经验分享】

23年、24年确实无愧于“品牌出海元年”的称号&#xff0c;23年出海四小龙——速卖通、TikTokshop、Temu、Shein在海外的爆发让大家看到了海外市场的活动&#xff1b;而24年则有更多的国内品牌将目光瞄向了海外市场&#xff0c;年后开工到今天基本上每天都有客户来咨询出海相关的…

Spring Cloud 是什么?(Spring Cloud 组件介绍)

什么是 Spring Cloud&#xff1f; Spring Cloud 是微服务系统架构的一站式解决方案&#xff0c;是各个微服务架构落地技术的集合体&#xff0c;让架构师、 开发者在使用微服务理念构建应用系统的时候&#xff0c; 面对各个环节的问题都可以找到相应的组件来处理&#xff0c;比…

C语言中32位浮点数的格式

以 GNU C为例&#xff0c;它遵循 IEEE 754-2008标准中制定的浮点表示规范。在该规范中定义了 5种不同大小的基础二进制浮点格式&#xff0c;包括&#xff1a;16位&#xff0c;32位&#xff0c;64位&#xff0c;128位&#xff0c;256位。其中&#xff0c;32位的格式被用作标准 C…

springboot马拉松赛事志愿者管理系统-计算机毕业设计源码80251

摘 要 随着马拉松运动的兴起和发展&#xff0c;马拉松赛事的组织和管理面临着越来越多的挑战&#xff0c;其中志愿者的招募、培训和管理是至关重要的一环。传统的人力资源管理方式已经无法满足大型马拉松赛事对志愿者团队的需求&#xff0c;因此基于现代信息技术的马拉松赛事志…

MongoDB如何安装并配置公网地址实现Navicat远程连接本地数据库

文章目录 前言1. 安装Docker2. 使用Docker拉取MongoDB镜像3. 创建并启动MongoDB容器4. 本地连接测试5. 公网远程访问本地MongoDB容器5.1 内网穿透工具安装5.2 创建远程连接公网地址5.3 使用固定TCP地址远程访问 前言 本文主要介绍如何在Linux Ubuntu系统快速部署MongoDB&#…

ssm“落雪”动漫网站-计算机毕业设计源码81664

目 录 摘要 1 绪论 1.1 研究背景 1.2 研究意义 1.3论文结构与章节安排 2系统分析 2.1 可行性分析 2.2 系统流程分析 2.2.1 数据新增流程 3.2.2 数据删除流程 2.3 系统功能分析 2.3.1 功能性分析 2.3.2 非功能性分析 2.4 系统用例分析 2.5本章小结 3 系统总体设…

开发必备基础知识【Linux环境变量文件合集】

开发必备基础知识【Linux环境变量文件合集】 在Linux系统中&#xff0c;环境配置文件用于定制用户的Shell环境&#xff0c;包括定义环境变量、设置命令别名、定义启动脚本等。不同的Shell&#xff08;如bash、zsh&#xff09;有着各自对应的配置文件。 .bashrc&#xff1a;每新…

使用myCobot280和OAK-D OpenCV DepthAI摄像头制作一个实时脸部跟踪的手机支架!

引言 由于YouTube和Netflix的出现&#xff0c;我们开始躺着看手机。然而&#xff0c;长时间用手拿着手机会让人感到疲劳。这次我们制作了一个可以在你眼前保持适当距离并调整位置的自动移动手机支架&#xff0c;让你无需用手拿着手机。请务必试试&#xff01; 准备工作 这次我们…