Context Menu implemented in Re
React Contextmenu react实现的右键菜单
ContextMenu in React with accessibility support. Live Examples can be found here 查看案例
Table of contents 目录 Installation Browser Support Usage API FAQs Contributors Changelog License Installation 安装教程Using npm
npm install --save rc-contextmenu
Using yarn
yarn add rc-contextmenu
Browser Support
支持的浏览器
IE 11 and Edge >= 12
FireFox >= 38
Chrome >= 47
Opera >= 34
Safari >= 8
Usage
DEMO
Simple example
import React from "react"; import ReactDOM from "react-dom"; import { ContextMenu, MenuItem, ContextMenuTrigger } from "react-contextmenu"; function handleClick(e, data) { console.log(data.foo); } function MyApp() { return ( <div> {/* NOTICE: id must be unique between EVERY <ContextMenuTrigger> and <ContextMenu> pair */} {/* NOTICE: inside the pair, <ContextMenuTrigger> and <ContextMenu> must have the same id */} <ContextMenuTrigger id="same_unique_identifier"> <div className="well">Right click to see the menu</div> </ContextMenuTrigger> <ContextMenu id="same_unique_identifier"> <MenuItem data={{foo: 'bar'}} onClick={this.handleClick}> ContextMenu Item 1 </MenuItem> <MenuItem data={{foo: 'bar'}} onClick={this.handleClick}> ContextMenu Item 2 </MenuItem> <MenuItem divider /> <MenuItem data={{foo: 'bar'}} onClick={this.handleClick}> ContextMenu Item 3 </MenuItem> </ContextMenu> </div> ); } ReactDOM.render(<MyApp myProp={12}/>, document.getElementById("main"));
see usage docs / examples for more details.
APIAPI docs
FAQsALL FAQs
Who's using react-contextmenu? react-data-grid teamup.com Spotify Web Player ContributorsAll Contributors
ChangelogFor Changelog, see releases
LicenseMIT. Copyright(c) Vivek Kumar Bansal
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。