0.1.0 • Published 9 years ago

react-drag-selector v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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