Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including bee-dropdown with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. require("react-dom/package.json"); // react-dom is a peer dependency. require("prop-types/package.json"); // prop-types is a peer dependency. var beeDropdown = require("bee-dropdown")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

bee-dropdown v2.0.9

dropdown ui component for react

bee-dropdown

npm version Build Status Coverage Status devDependency Status NPM downloads

浏览器支持

IEChromeFirefoxOperaSafari
IE 9+ ✔Chrome 31.0+ ✔Firefox 31.0+ ✔Opera 30.0+ ✔Safari 7.0+ ✔

下拉列表组件

使用方法

先进行下载bee-button包

npm install --save bee-dropdown

import Dropdown from 'bee-dropdown';
import Button from 'bee-button';
import Menu, { MenuItem } from 'bee-menus';

class Demo extends Component {
   render () {

       const menu = (
             <Menu multiple>
               <MenuItem key="1">借款合同</MenuItem>
               <MenuItem key="2">抵/质押合同</MenuItem>
               <MenuItem key="3">担保合同</MenuItem>
               <MenuItem key="4">联保合同</MenuItem>
               <MenuItem key="5">合同审批</MenuItem>
               <MenuItem key="6">抵/质押合同跟踪</MenuItem>
             </Menu>
         );
       return (
            <Dropdown
                trigger={['click']}
                overlay={menu}
                animation="slide-up">
                <Button colors='primary'>点击显示</Button>
            </Dropdown>
       )
   }
}

样式引入

  • 可以使用link引入build目录下Dropdown.css
<link rel="stylesheet" href="./node_modules/bee-dropdown/build/Dropdown.css">
  • 可以在js中import样式
import "./node_modules/bee-dropdown/src/Dropdown.scss"
//或是
import "./node_modules/bee-dropdown/build/Dropdown.css"

API

参数说明类型默认值
transitionName下拉显示动画--
trigger触发的事件数组array['hover']
placement触发的位置支持bottomLeft/bottomCenter/bottomRight/topLeft/topCenter/topRight'bottomLeft'
overlay要显示的菜单element/reactComponent-
animation触发时的动画string-
overlayClassName传递给弹出菜单的classNamestring''
align对齐方式object{}
overlayStyle传递给弹出菜单的styleobject{}
onVisibleChange下拉菜单显示与否的钩子函数function() => {}
showAction显示时的钩子函数数组array[]
hideAction隐藏时的钩子函数数组array[]
getPopupContainer获取要添加的容器function默认是body
getDocument点击隐藏的容器,适用于出现iframe的情况functiondocument
disabled是否禁用boolfalse
delay延迟显示隐藏时间,单位毫秒number-
delayShow延迟显示时间,单位毫秒number-
delayHide延迟隐藏时间,单位毫秒number-
minOverlayWidthMatchTrigger是否设置下拉的最小宽度booltrue

开发调试

$ npm install -g bee-tools
$ git clone https://github.com/tinper-bee/bee-dropdown
$ cd bee-dropdown
$ npm install
$ npm run dev
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free