From ac2899efbb451dedc87f140b63ccec7a4fc309f9 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Mon, 8 Jun 2015 19:10:47 +0800 Subject: [PATCH] add dropdown --- components/dropdown/demo/basic.md | 30 ++++++++++++++++++++++++++++++ components/dropdown/index.jsx | 1 + components/dropdown/index.md | 27 +++++++++++++++++++++++++++ components/menu/index.jsx | 1 + index.js | 4 +++- package.json | 2 ++ theme/templates/layout.html | 2 +- 7 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 components/dropdown/demo/basic.md create mode 100644 components/dropdown/index.jsx create mode 100644 components/dropdown/index.md create mode 100644 components/menu/index.jsx diff --git a/components/dropdown/demo/basic.md b/components/dropdown/demo/basic.md new file mode 100644 index 0000000000..82f1df642d --- /dev/null +++ b/components/dropdown/demo/basic.md @@ -0,0 +1,30 @@ +# 基本 + +- order: 0 + +点击出发 + +--- + +````jsx +var Menu = antd.Menu; +var Dropdown = antd.Dropdown; + +function onClick(key){ + alert('select ' + key); +} + +var menu = + disabled + 第一个菜单项 + + 第二个菜单项 +; + + +React.render( + + + +, document.getElementById('components-dropdown-demo-basic')); +```` diff --git a/components/dropdown/index.jsx b/components/dropdown/index.jsx new file mode 100644 index 0000000000..f113cae5a8 --- /dev/null +++ b/components/dropdown/index.jsx @@ -0,0 +1 @@ +module.exports = require('rc-dropdown'); \ No newline at end of file diff --git a/components/dropdown/index.md b/components/dropdown/index.md new file mode 100644 index 0000000000..d5d799296b --- /dev/null +++ b/components/dropdown/index.md @@ -0,0 +1,27 @@ +# Dropdown + +- category: Components +- chinese: 下拉菜单 + +--- + +下拉菜单 + +## 何时使用 + +需要点击一个触点出现一个菜单时使用 + +## API + +属性如下 + +| 成员 | 说明 | 类型 | 默认值 | +|----------|----------------|------------------|--------------| +| animation | 动画名称 | String ("slide-up") | 无 | +| trigger | 触发下来行为 | "click" or "mouse" | 无 | +| overlay | 菜单节点 | React.Element | 无 | + + +菜单可由 antd.Menu 取得,可设置 onClick 回调,菜单还包括菜单项 antd.Menu.Item,分割线 antd.Menu.Divider + +注意: Menu.Item 必须设置唯一的 key 属性 diff --git a/components/menu/index.jsx b/components/menu/index.jsx new file mode 100644 index 0000000000..5fedc2fba4 --- /dev/null +++ b/components/menu/index.jsx @@ -0,0 +1 @@ +module.exports = require('rc-menu'); \ No newline at end of file diff --git a/index.js b/index.js index 62c5a691a6..d426864720 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,9 @@ var antd = { datepicker: require('./components/datepicker'), tooltip: require('./components/tooltip'), tab: require('./components/tab'), - modal: require('./components/modal') + modal: require('./components/modal'), + Menu:require('./components/menu'), + Dropdown:require('./components/dropdown') }; module.exports = window.antd = antd; diff --git a/package.json b/package.json index 70e19ca58f..7fc7e89478 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "gregorian-calendar-format": "~3.0.1", "rc-calendar": "~3.8.0", "rc-dialog": "~4.1.1", + "rc-dropdown": "~1.0.0", + "rc-menu": "~3.3.0", "rc-tabs": "~5.0.5", "rc-tooltip": "~1.2.0" }, diff --git a/theme/templates/layout.html b/theme/templates/layout.html index 8570e9b5c5..e10b3e7e39 100644 --- a/theme/templates/layout.html +++ b/theme/templates/layout.html @@ -16,7 +16,7 @@ {% block styles %}{% endblock %} - + {% block scripts %}{% endblock %}