el table draggable
v1.4.12
中文文档
让el-table支持sortable.js
演示页面
sortablejs
中的几乎所有选项el-table
yarn add el-table-draggable
npm i -S el-table-draggable
import ElTableDraggable from "el-table-draggable" ;
export default {
components : {
ElTableDraggable ,
} ,
} ;
< template >
< el-table-draggable >
< el-table row-key > </ el-table >
</ el-table-draggable >
</ template >
el-table的包装标签,默认为div
支持拖栏
设置 onMove 回调
onMove : function ( /**Event*/ evt , /**Event*/ originalEvent , domInfo ) {
// Example: https://jsbin.com/nawahef/edit?js,output
evt . dragged ; // dragged HTMLElement
evt . draggedRect ; // DOMRect {left, top, right, bottom}
evt . related ; // HTMLElement on which have guided
evt . relatedRect ; // DOMRect
evt . willInsertAfter ; // Boolean that is true if Sortable will insert drag element after target by default
originalEvent . clientY ; // mouse position
domInfo . dragged // the origin dom info of dragged tr, like parent domInfo, level, data, and it's index
domInfo . related // like dragged
// return false; — for cancel
// return -1; — insert before target
// return 1; — insert after target
} ,
sortablejs 的选项
更改后的数据或列
sortablejs 的选项,选项以on
开头,示例onSort => @sort
由我来一杯咖啡