首页 > 技术文章 > vue 添加表格

New-fanfan 2021-02-26 10:27 原文

  • 每一个表格是循环出来的

       

  • 添加表格

       

  • 添加表格的方法

       

  • 复制表格

     

  • 复制表格的方法

     

 

     //复制表格
    copyTable(main) {
      this.$confirm(`确定复制当前表格?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let obj = JSON.parse(JSON.stringify(main));
          this.tableData.push(obj);
        })
        .then(() => {
          this.msgSuccess("复制成功");
        })
        .catch(function () {});
    },
  • 删除表格

     

  • 删除表格的方法 

     

     //删除表格
    deleteTable(index) {
      this.$confirm(`确定删除当前表格?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.tableData.splice(index, 1);
        })
        .then(() => {
          this.msgSuccess("删除成功");
        })
        .catch(function () {});
    },

 

 

 

 

推荐阅读