import sortable from "sortable.js"; //引入的npm
methods:{
//议题排序
tableSort(){
const tbody = document.querySelector('.el-table_body-wrapper tbody');
console.log('tbody',tbody)
let ops = {
onEnd:(evt)={
const arrsp = this.tableData.splice(evt.oldIndex,1)[0];
this.tableData.splice(evt.newIndex,0,arrsp);
console.log('this.tableData',this.tableData)
this.$forceUpdate();
},
}
sortable.create(tbody,ops);
},
}
watch:{
tableData:{
immediate:false,
handler(){
const tbody = document.querySelector('.el-table_body-wrapper tbody');
console.log(tbody);
}
let ops = {
onEnd:(evt)={
const arrsp = this.tableData.splice(evt.oldIndex,1)[0];
this.tableData.splice(evt.newIndex,0,arrsp);
console.log('this.tableData',this.tableData)
this.$forceUpdate();
}
}
sortable.create(tbody,ops);
}
},
mounted(){
this.tableSort();
},