el-table表格拖动排序
作者:互联网
sortable.js->minix文件
import Sortable from 'sortablejs' export default { data () { return {} }, computed: { }, methods: { rowDrop () { const tbody = document.querySelector('.el-table__body-wrapper tbody') if (!tbody) return Sortable.create(tbody, { animation: 600, onEnd: this.onEnd }) }, onEnd ({ newIndex, oldIndex }) { const currRow = this.tableData.splice(oldIndex, 1)[0] this.tableData.splice(newIndex, 0, currRow) this.confirmTaskClassificationTableOrder && this.confirmTaskClassificationTableOrder() // 分类表格排序 this.confirmTaskManagentTableOrder && this.confirmTaskManagentTableOrder() // 任务管理表格排序 } }, created () {}, mounted () { // this.rowDrop() } }View Code
标签:el,表格,oldIndex,拖动,tbody,table,排序,onEnd 来源: https://www.cnblogs.com/xiaoliziaaa/p/13972337.html