elementUI+vue 组件 表格嵌套

一. 表格嵌套

          代码段:

  
        //type="expand" 带下层数据的字段
        
      
      
      
      
      
      
        
      
    

 

数据格式:

tableData5: [{
              names: 'S1-科技楼',
              desc: '公司楼',
              tableData3: [{
                  date: '2016-05-03',
                  name: '王小虎',
                  address: '上海市普陀区金沙江路 1518 弄'
              }]
          },
          {
              names: 'S2-科技楼',
              desc: '上课喽',
              tableData3: [{
                  date: '2016-05-03',
                  name: '张小虎',
                  address: '上海市普陀区金沙江路 32421弄'
              }]
          }],`

 

效果图:
elementUI+vue 组件 表格嵌套_第1张图片

//添加数据

this.list.unshift(this.temp);

//删除数据

const index = this.list.indexOf(row); //找到要删除数据在list中的位置 this.list.splice(index, 1); //通过splice 删除数据

//修改数据

const index = this.list.indexOf(row); //找到修改的数据在list中的位置

this.list.splice(index, 1,this.updatedData); //通过splice 替换数据 触发视图更新

 

参考网址:https://juejin.im/post/593121aa0ce4630057f70d35#heading-18

https://segmentfault.com/q/1010000011699125


 

 

你可能感兴趣的:(vue)