React mouse multi-selection function configuration method

React mouse multi-selection function configuration method

Generally, lists have selection functions, and single selection, double selection and multiple selection are very common. In custom loop lists and images, implement mouse single selection, multiple selection, and inverse selection functions.

# React mousemultiples
# React mouse multi-select component

React mouse multi-select component

limitation

> Mainly realizes the effect of mouse multi-selection. Without destroying the original list, the embedded component has the mouse multi-selection function.

npm package address [link](https://www.npmjs.com/package/mousemultiples)

Install

npm i mousemultiples

Using Configuration Items

/**
 * wrapperScroll?: any, // scroll unit 'ID';
 *
  * itemClass: string, // List box general carrying class
 *
  * activeClass?: string, // List box selected class
 *
  * isDataChange: any, // rendered array, detect data changes *
  * activePosition?: any, // Actively select data *
  * onSelected: (pos: any, item: any, data: any) => void, // drag *
  * onSingleSelected?: (pos: any, item: any, data: any) => void, // click *
  * Note: itemClass and children loop box className must be consistent, and the same box must be bound to data-position, which exports the selected unique identification. * Note: Items with question marks are optional, otherwise they are required.
 */

> Operation Instructions:
> Mouse click, single selection
> Ctrl + mouse click, multiple selection, check selection, invert selection
> Ctrl + a Select all
> Drag the mouse to select multiple ranges

Example:

<MouseMultiples
    wrapperScroll="classify-img_body"
    itemClass='selection_box'
    activeClass='selection_box-active'
    activePosition={activePosition}
    onSelected={selected}
    isDataChange={imageLists}
    {imageLists.map(item => {
        return (
            <div 
            className="selection_box" 
            data-position={item.FileId}
            >
                <div className="listImage"><img src={ item.FileUrl } /></div>
            </div>
        )
    })}
</MouseMultiples>

> Description:

> children custom design, style, grid, selection effect, etc.

> Import the component and directly wrap the designed list, make sure the className and itemClass are consistent, make sure to import data-position, and make sure activeClass has a highlighted style. . .

The above is the detailed content of React mouse multi-selection function. For more information about React mouse multi-selection, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Use react-tooltip plugin in JS to display mouse hover box
  • ReactJS implements single-select, multiple-select and reverse-select examples in forms

<<:  MySQL 5.7.18 Archive compressed version installation tutorial

>>:  How to delete an image in Docker

Recommend

MySQL log system detailed information sharing

Anyone who has worked on a large system knows tha...

Text mode in IE! Introduction to the role of DOCTYPE

After solving the form auto-fill problem discussed...

How to write HTML head in mobile device web development

Copy code The code is as follows: <head> &l...

Javascript to achieve drumming effect

This article shares the specific code of Javascri...

MySQL index for beginners

Preface Since the most important data structure i...

Analysis of the use and principle of Docker Swarm cluster management

Swarm Cluster Management Introduction Docker Swar...

How to set up jar application startup on CentOS7

Pitfalls encountered during project deployment Wh...

Tutorial on setting up scheduled tasks to backup the Oracle database under Linux

1. Check the character set of the database The ch...

JavaScript realizes magnifying glass special effects

The effect to be achieved: When the mouse is plac...

Memcached method for building cache server

Preface Many web applications store data in a rel...

js to achieve interesting countdown effect

js interesting countdown case, for your reference...

Vue two fields joint verification to achieve the password modification function

Table of contents 1. Introduction 2. Solution Imp...

Detailed introduction to the MySQL installation tutorial under Windows

Table of contents 1. Some concepts you need to un...

MySQL database basic syntax and operation

MySQL database basic syntax DDL Operations Create...