0.1.0 • Published 9 years ago
react-drag-selector v0.1.0
About React-Drag-Selector
react框选组件,支持批量框选拖放
Demo
Usage
import React from 'react'
import Selector from './selector'
// code...
const Component = React.createClass({
render() {
return (
<div
onDrop={this.handleDrop}
onDragOver={this.handleDragOver}
>
<Selector onSelectionChange={this.handleSelectionChange}>
{[
<SelectionItem key={1} />,
<SelectionItem key={2} />,
<SelectionItem key={3} />
]}
</Selector>
</div>
)
},
handleSelectionChange(selectionItemsMap) {
// code...
},
handleDragOver(event) {
event.preventDefault();
},
handleDrop(event) {
let newItems = event.dataTransfer.getData('dragKeyList');
// code...
event.preventDefault();
}
});
0.1.0
9 years ago