element-ui table表格行拖拽
简单案例

此功能借助Sortable.js来实现 中文网址: sortable.js
1.安装插件
npm install sortablejs --save
2.vue页面中引入并注册
import Sortable from 'sortablejs'
export default {
components: {
Sortable
},
}
3.使用方法
el-table要指定row-key属性,值必须是唯一值,可以取每一行的id
<el-table class="drag" highlight-current-row row-key="dataId" :data="tableData" :stripe="true" :border="true" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection

本文介绍了如何在Vue项目中利用Sortable.js插件为el-table的行添加拖拽排序功能,包括安装、引入、配置和使用步骤,适合前端开发者快速上手。
最低0.47元/天 解锁文章
299

被折叠的 条评论
为什么被折叠?



