Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

react-drag-selector

0.1.0 • Public • Published

About React-Drag-Selector

react框选组件,支持批量框选拖放

Demo

View 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();
  }
});
 

Install

npm i react-drag-selector

DownloadsWeekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • avatar