vuecli+element 实现基础表格的增删改查

本文通过VueCLI和ElementUI组件库,演示了如何实现基础表格的增删改查功能。删除操作使用`row.splice(index, 1)`从数组中移除元素,新增通过`this.tableData.push`将数据添加到表格,编辑直接修改`tableData`的值,搜索功能借助ElementUI内置功能完成。" 122820903,11781710,独立站最佳聊天机器人Top10推荐,"['自然语言处理', '数据分析', '电商工具']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

因为最近在学VUE 也算是练手了 不说了直接上代码

<template>
  <div>
    <el-table
      :data="tableData.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase()))"
      style="width: 100%"
    >
      <el-table-column label="日期" width="180">
        <template slot-scope="scope">
          <i class="el-icon-time"></i>
          <span style="margin-left: 10px">{
   
   {
   
    scope.row.date }}</span>
        </template>
      </el-table-column>
      <el-table-column label="书名" width="180">
        <template slot-scope="scope">
          <el-popover trigger="hover" placement="top">
            <p>书名: {
   
   {
   
    scope.row.name }}</p>
            <p>出版社: {
   
   {
   
    scope.row.address }}</p>
            <div slot="reference" class="name-wrapper">
              <el-tag size="medium">{
   
   {
   
    scope.row.name }}</el-tag>
            </div>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot="header" slot-scope="scope">
          <el-input v-model="search" size="mini" placeholder="输入关键字搜索" />
        </template>
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, tableData)">编辑</el
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值