React中使用sortablejs实现拖拽排序

1、使用npm装包

$ npm install sortablejs --save

2、引入Sortable

import Sortable from "sortablejs";

3、使用方法

{menus && menus.map((item, i) => { return this.renderSelectedItemView(item, i); })}
sortableGroupDecorator = componentBackingInstance => {
    if (componentBackingInstance) {
        let options = {
            draggable: ".rows",
            animation: "150",
            onEnd: evt => {
                let children = evt.to.children;
            }
        };
        Sortable.create(componentBackingInstance, options);
    }
};

你可能感兴趣的:(我的前端)