GithubHelp home page GithubHelp logo

shangyunsi / uxcore-menu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uxcore/uxcore-menu

0.0 0.0 0.0 100 KB

Menu Component based on React

Home Page: http://uxco.re/components/menu/

JavaScript 36.63% CSS 60.95% HTML 2.43%

uxcore-menu's Introduction


uxcore-menu Dependency Status devDependency Status

TL;DR

uxcore-menu ui component for react

setup develop environment

$ git clone https://github.com/uxcore/uxcore-menu
$ cd uxcore-menu
$ npm install
$ gulp server

Usage

import ReactDOM from 'react-dom';
import RcMenu, {SubMenu, Item, Divider} from 'rc-menu';

ReactDOM.render(
	<Menu >
		<Item key="mail">
			<i className="kuma-icon kuma-icon-email"></i>导航一
		</Item>
		<Item key="app">
			<i className="kuma-icon kuma-icon-wangwang"></i>导航二
		</Item>
		<SubMenu title={<span><i className="kuma-icon kuma-icon-setting"></i>导航 - 子菜单</span>}>
			<Item key="setting:1">选项1</Item>
			<Item key="setting:2">选项2</Item>
			<Item key="setting:3">选项3</Item>
			<Item key="setting:4">选项4</Item>
		</SubMenu>
		<Item key="alipay">
			<a href="#" target="_blank">导航四 - 链接</a>
		</Item>
	</Menu>,
	target);

demo

http://uxcore.github.io/uxcore/components/menu/

API

Props

Menu

配置项 说明 类型 默认值
mode 菜单类型 enum 'vertical', 'horizontal', 'inline' vertical
selectedKeys 当前选中的菜单项 key 数组
defaultSelectedKeys 初始选中的菜单项 key 数组
openKeys 当前展开的菜单项 key 数组
defaultOpenKeys 初始展开的菜单项 key 数组
onSelect 被选中时调用,参数 {item, key, selectedKeys} 对象 function
onDeselect 取消选中时调用,参数 {item, key, selectedKeys} 对象,仅在 multiple 生效 function
onOpenChange 菜单打开或关闭时调用,参数 openKeys 数组 function
onOpen 同 onOpenChange,为了兼容旧版本保留的方法,将来会移除。参数 {openKeys} 对象 function
onClose 同 onOpenChange,为了兼容旧版本保留的方法,将来会移除。参数 {openKeys} 对象 function
onClick 点击 menuitem 调用此函数,参数为 {item, key} function
style 根节点样式 object
lineClamp 文字行数,超出则显示省略号(仅在 inline 模式下且支持 line-clamp 属性的浏览器上生效) number 1

Item

配置项 说明 类型 默认值
disabled 是否禁用 Boolean false
key item 的唯一标志 String

SubMenu

配置项 说明 类型 默认值
title 子菜单项值 String or React.Element
children (MenuItem or SubMenu)[] 子菜单的菜单项

uxcore-menu's People

Contributors

micate avatar eternalsky avatar jianfei avatar macisi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.