vue+elementUI 在表格中动态增加与删除行

1、定义一个数组,存放表格数据(注:表格要给定一个高度,添加数据超过这个高度会自动出现滚动条)

      ttable:[],

2、把数组中表格的每一行定义成一个对象,添加到数组中

     newconditions:function(){
     var newValue = {};
     //添加新的行数
     this.ttable.push(newValue);
     },

3、删除对象

     remove:function(index,row){//删除行数

    this.ttable.splice(index, 1)
    },

 

posted on 2021-12-29 09:05  萌CAT  阅读(1265)  评论(0编辑  收藏  举报

导航