el-table 的动态表单
1.导入sortable
2.导入
tableHeadersCopy: [ ] //是prop的数据 tableHeadersCopy[index].prop
// 列拖拽
columnDrop() {
console.log('this.tableHeadersCopy未执行前', this.tableHeadersCopy)
const wrapperTr = document.querySelector('.el-table__header-wrapper tr')
this.sortable = Sortable.create(wrapperTr, {
animation: 180,
delay: 0,
onEnd: evt => {
console.log('evt', evt)
const oldItem = this.tableHeadersCopy[evt.oldIndex]
this.tableHeadersCopy.splice(evt.oldIndex, 1)
this.tableHeadersCopy.splice(evt.newIndex, 0, oldItem)
},
})
},