$ cnpm install @uyun/ec-sortable
基于 react-dnd
的排序组件。
作者:马琪斌
通过拖拽操作对子组件进行排序,并触发相应的业务逻辑。
通过拖拽进行排序,为避免每一项重复渲染,建议使用 react-addons-update
更新 state
。
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
collection | 设置需要排序的数组 | any[] | - |
itemRender | 设置单列需要排序的组件 | function | |
onDrop | drop 后返回的新数据 |
function | - |
itemKey | 排序行 key 的取值,可以是字符串或一个函数 | string/function(record) | 'key' |
targetName | 组件标签名称 | string | div |
className | 组件className | string | - |
dragHandle | 仅可以用来拖拽的组件 | ReactNode | - |
itemClassName | 每一项className,仅配合配合dragHandle组件使用 | string | - |
Copyright 2013 - present © cnpmjs.org