element-plus-table-dragable

A directive what used sortablejs to add drag support for element-plus's table component base on vue3.
19,522 14
Install
npm install element-plus-table-dragable
Latest Version:1.0.0
License:ISC
Last Updated:Aug 4, 2022
Links: GitHub  ·  npm
Maintainer: guolaopi

element-plus-table-dragable

A directive what used sortablejs to add drag support for element-plus's table component base on vue3.

Useage

<template>
    <el-table 
        v-dragable="dragOptions" 
        :data="data"
    >
    </el-table>
</template>

<script setup>
import { vDragable } from "element-plus-table-dragable"; 

const dragOptions = [
    {
        selector: "thead tr", // add drag support for column
        option: { // sortablejs's option
            animation: 150,
            onEnd: (evt) => {
                /* you can define a 'columns' ref 
                and use v-for render it in table's slot. 
                then you can change index of the item in 'column' here 
                to implement drag column to sort */
                console.log(evt.oldIndex, evt.newIndex);
            },
        },
    },
    {
        selector: "tbody", // add drag support for row
        option: { // sortablejs's option
            animation: 150,
            onEnd: (evt) => {
                console.log(evt.oldIndex, evt.newIndex);
            },
        },
    },
];
</script> 

Related Packages

ez-tables

Vue3 + Element Plus table components (Table, TableActionDropdown & TableQueryWra...

1,417
lk-component-element

一个基于Element Plus封装的Vue3功能组件库

3,095
el-table-jsx

文档地址

2,079 5
element-plus-generator

基于element-plus封装的表格、表单生成器

2,054
@2h-lin/components

Vue3组件库,基于Element Plus的增强组件

1,284

Version History

Version Released License
1.0.0 ISC