-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
305 lines (282 loc) · 18.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<!DOCTYPE html><html><head><title>uxcore - UXCORE UI Framework</title><link rel="stylesheet" href="//g.alicdn.com/platform/common/s/1.1/global/global.css"><link rel="stylesheet" href="/uxcore/static/uxcore.css"><link rel="stylesheet" href="/uxcore/static/github-gist.min.css"><script src="https://alinw.alicdn.com/uxcore/uxcore-lib/??es5-shim/4.1.12/es5-shim.min.js,es5-shim/4.1.12/es5-sham.min.js,react/0.14.0/react-with-addons.min.js,react/0.14.0/react-dom.min.js,rangy/1.3.0/rangy-core.min.js,jquery/1.11/jquery.min.js"></script><script src="/uxcore/static/highlight.min.js"></script><script src="/uxcore/static/uxcore.js"></script><script src="https://alinw.alicdn.com/uxcore/uxcore-lib/tinymce/4.2.5/tinymce-full.min.js"></script><script>(function(w){
w.require = function(name){
return w.UXCORE[name];
}
})(window)</script></head><body><nav id="J-head" class="site-nav"><h1 class="logo">UXCORE</h1><ul class="nav-list"><li><a href="/uxcore/">首页</a></li><li><a href="/uxcore/css/base/">css</a></li><li><a href="/uxcore/components/calendar/">组件</a></li></ul></nav><div id="J-main" class="kuma-layout-full site-main"><aside class="site-aside"><ul><li><a href="/uxcore/components/calendar">Calendar</a></li><li><a href="/uxcore/components/dialog">Dialog</a></li><li><a href="/uxcore/components/select2">Select2</a></li><li><a href="/uxcore/components/pagination">Pagination</a></li><li><a href="/uxcore/components/tooltip">Tooltip</a></li><li><a href="/uxcore/components/tabs">Tabs</a></li><li><a href="/uxcore/components/grid">Grid</a></li><li><a href="/uxcore/components/form">Form</a></li><li class="current"><a href="/uxcore/components/dropdown">Dropdown</a></li><li><a href="/uxcore/components/mention">Mention</a></li><li><a href="/uxcore/components/tree">Tree</a></li><li><a href="/uxcore/components/transfer">Transfer</a></li><li><a href="/uxcore/components/popover">Popover</a></li><li><a href="/uxcore/components/hovercard">Hovercard</a></li><li><a href="/uxcore/components/uploader">Uploader</a></li><li><a href="/uxcore/components/collapse">Collapse</a></li><li><a href="/uxcore/components/progress">Progress</a></li><li><a href="/uxcore/components/steps">Steps</a></li><li><a href="/uxcore/components/menu">Menu</a></li><li><a href="/uxcore/components/button">Button</a></li></ul></aside><article class="site-content"><header class="post-title"><h1>Dropdown</h1><section class="meta"><span class="author"><b>author: </b>vincent.bian</span><span class="github"><b>github: </b><a href="https://github.com/uxcore/dropdown.git" target="_blank">Dropdown</a></span><span class="version"> <b>版本: </b>0.1.5</span><span class="description"><b>描述: </b>dropdown component </span></section></header><div id="J-markdown" class="markdown"><p>向下弹出的列表。</p>
<h2 id="何时使用">何时使用</h2><p>当页面元素过多时,用此组件可以收纳元素。点击或移入触点,会出现一个下拉菜单。可在列表中进行选择,并执行相应的命令。</p>
<h2 id="api">API</h2><table>
<thead>
<tr>
<th>参数</th>
<th>说明</th>
<th>类型</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>trigger</td>
<td>触发下来行为</td>
<td>"click" or "hover"</td>
<td>hover</td>
</tr>
<tr>
<td>overlay</td>
<td>菜单节点</td>
<td>React.Element</td>
<td>无</td>
</tr>
</tbody>
</table>
</div><h2 class="site-demos"> <i class="kuma-icon kuma-icon-graph"></i>组件演示</h2><div id="code-box-components-dropdown-demo-default" class="code-box"><div class="code-box-meta"><div class="code-box-title"><i class="kuma-icon kuma-icon-tag"></i><em>基本</em></div></div><div class="code-box-demo"><div id="components-dropdown-demo-default"></div></div><div class="code-box-markdown markdown"><script>(function(){"use strict";
var UD = require('uxcore-dropdown');
var Dropdown = UD.Dropdown;
var Menu = UD.Menu;
var menu = React.createElement(
Menu,
null,
React.createElement(
Menu.Item,
null,
React.createElement(
"a",
{ target: "_blank", href: "http://www.alipay.com/" },
"第一个菜单项"
)
),
React.createElement(
Menu.Item,
null,
React.createElement(
"a",
{ target: "_blank", href: "http://www.taobao.com/" },
"第二个菜单项"
)
),
React.createElement(
Menu.Item,
null,
React.createElement(
"a",
{ target: "_blank", href: "http://www.tmall.com/" },
"第三个菜单项"
)
)
);
ReactDOM.render(React.createElement(
Dropdown,
{ overlay: menu },
React.createElement(
"button",
{ className: "kuma-button kuma-button-sblue" },
"hover触发"
)
), document.getElementById('components-dropdown-demo-default'));})()</script><div class="highlight"><pre><code class="javascript"><span class="keyword">var</span> UD = require(<span class="string">'uxcore-dropdown'</span>);
<span class="keyword">var</span> Dropdown = UD.Dropdown;
<span class="keyword">var</span> Menu = UD.Menu;
<span class="keyword">var</span> menu = <span class="xml"><span class="tag"><<span class="title">Menu</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.alipay.com/"</span>></span>第一个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.taobao.com/"</span>></span>第二个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.tmall.com/"</span>></span>第三个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"></<span class="title">Menu</span>></span>;</span>
ReactDOM.render(
<span class="xml"><span class="tag"><<span class="title">Dropdown</span> <span class="attribute">overlay</span>=<span class="value">{menu}</span>></span>
<span class="tag"><<span class="title">button</span> <span class="attribute">className</span>=<span class="value">"kuma-button kuma-button-sblue"</span>></span>hover触发<span class="tag"></<span class="title">button</span>></span>
<span class="tag"></<span class="title">Dropdown</span>></span>,
document.getElementById('components-dropdown-demo-default')
);</span></code></pre></div></div></div><div id="code-box-components-dropdown-demo-click" class="code-box"><div class="code-box-meta"><div class="code-box-title"><i class="kuma-icon kuma-icon-tag"></i><em>点击触发</em></div></div><div class="code-box-demo"><div id="components-dropdown-demo-click"></div></div><div class="code-box-markdown markdown"><script>(function(){"use strict";
var UD = require('uxcore-dropdown');
var Dropdown = UD.Dropdown;
var Menu = UD.Menu;
var menu = React.createElement(
Menu,
null,
React.createElement(
Menu.Item,
null,
React.createElement(
"a",
{ target: "_blank", href: "http://www.alipay.com/" },
"第一个菜单项"
)
),
React.createElement(
Menu.Item,
null,
React.createElement(
"a",
{ target: "_blank", href: "http://www.taobao.com/" },
"第二个菜单项"
)
),
React.createElement(
Menu.Item,
null,
React.createElement(
"a",
{ target: "_blank", href: "http://www.tmall.com/" },
"第三个菜单项"
)
)
);
ReactDOM.render(React.createElement(
Dropdown,
{ overlay: menu, trigger: "click" },
React.createElement(
"button",
{ className: "kuma-button kuma-button-sblue" },
"点击触发"
)
), document.getElementById('components-dropdown-demo-click'));})()</script><div class="highlight"><pre><code class="javascript"><span class="keyword">var</span> UD = require(<span class="string">'uxcore-dropdown'</span>);
<span class="keyword">var</span> Dropdown = UD.Dropdown;
<span class="keyword">var</span> Menu = UD.Menu;
<span class="keyword">var</span> menu = <span class="xml"><span class="tag"><<span class="title">Menu</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.alipay.com/"</span>></span>第一个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.taobao.com/"</span>></span>第二个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.tmall.com/"</span>></span>第三个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"></<span class="title">Menu</span>></span>;</span>
ReactDOM.render(
<span class="xml"><span class="tag"><<span class="title">Dropdown</span> <span class="attribute">overlay</span>=<span class="value">{menu}</span> <span class="attribute">trigger</span>=<span class="value">"click"</span>></span>
<span class="tag"><<span class="title">button</span> <span class="attribute">className</span>=<span class="value">"kuma-button kuma-button-sblue"</span>></span>点击触发<span class="tag"></<span class="title">button</span>></span>
<span class="tag"></<span class="title">Dropdown</span>></span>,
document.getElementById('components-dropdown-demo-click')
);</span></code></pre></div></div></div><div id="code-box-components-dropdown-demo-events" class="code-box"><div class="code-box-meta"><div class="code-box-title"><i class="kuma-icon kuma-icon-tag"></i><em>触发事件</em></div></div><div class="code-box-demo"><div id="components-dropdown-demo-events"></div></div><div class="code-box-markdown markdown"><script>(function(){'use strict';
var UD = require('uxcore-dropdown');
var Dropdown = UD.Dropdown;
var Menu = UD.Menu;
var onClick = function onClick(_ref) {
var key = _ref.key;
alert('选中了菜单' + key);
};
var menu = React.createElement(
Menu,
{ onClick: onClick },
React.createElement(
Menu.Item,
null,
React.createElement(
'a',
{ target: '_blank', href: 'http://www.alipay.com/' },
'第一个菜单项'
)
),
React.createElement(
Menu.Item,
null,
React.createElement(
'a',
{ target: '_blank', href: 'http://www.taobao.com/' },
'第二个菜单项'
)
),
React.createElement(
Menu.Item,
null,
React.createElement(
'a',
{ target: '_blank', href: 'http://www.tmall.com/' },
'第三个菜单项'
)
)
);
ReactDOM.render(React.createElement(
Dropdown,
{ overlay: menu },
React.createElement(
'button',
{ className: 'kuma-button kuma-button-sblue' },
'触发事件'
)
), document.getElementById('components-dropdown-demo-events'));})()</script><div class="highlight"><pre><code class="javascript"><span class="keyword">var</span> UD = require(<span class="string">'uxcore-dropdown'</span>);
<span class="keyword">var</span> Dropdown = UD.Dropdown;
<span class="keyword">var</span> Menu = UD.Menu;
<span class="keyword">var</span> onClick = <span class="function"><span class="keyword">function</span> <span class="params">({key})</span>{</span>
alert(<span class="string">'选中了菜单'</span> + key);
};
<span class="keyword">var</span> menu = <span class="xml"><span class="tag"><<span class="title">Menu</span> <span class="attribute">onClick</span>=<span class="value">{onClick}</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.alipay.com/"</span>></span>第一个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.taobao.com/"</span>></span>第二个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.tmall.com/"</span>></span>第三个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"></<span class="title">Menu</span>></span>;</span>
ReactDOM.render(
<span class="xml"><span class="tag"><<span class="title">Dropdown</span> <span class="attribute">overlay</span>=<span class="value">{menu}</span>></span>
<span class="tag"><<span class="title">button</span> <span class="attribute">className</span>=<span class="value">"kuma-button kuma-button-sblue"</span>></span>触发事件<span class="tag"></<span class="title">button</span>></span>
<span class="tag"></<span class="title">Dropdown</span>></span>,
document.getElementById('components-dropdown-demo-events')
);</span></code></pre></div></div></div><div id="code-box-components-dropdown-demo-other" class="code-box"><div class="code-box-meta"><div class="code-box-title"><i class="kuma-icon kuma-icon-tag"></i><em>其他元素</em></div></div><div class="code-box-demo"><div id="components-dropdown-demo-other"></div></div><div class="code-box-markdown markdown"><script>(function(){"use strict";
var UD = require('uxcore-dropdown');
var Dropdown = UD.Dropdown;
var Menu = UD.Menu;
var menu = React.createElement(
Menu,
null,
React.createElement(
Menu.Item,
{ key: "0" },
React.createElement(
"a",
{ target: "_blank", href: "http://www.alipay.com/" },
"第一个菜单项"
)
),
React.createElement(
Menu.Item,
{ key: "1" },
React.createElement(
"a",
{ target: "_blank", href: "http://www.taobao.com/" },
"第二个菜单项"
)
),
React.createElement(Menu.Divider, null),
React.createElement(
Menu.Item,
{ key: "3", disabled: true },
"第三个菜单项(不可用)"
)
);
ReactDOM.render(React.createElement(
Dropdown,
{ overlay: menu },
React.createElement(
"button",
{ className: "kuma-button kuma-button-sblue" },
"分割线和不可用菜单项"
)
), document.getElementById('components-dropdown-demo-other'));})()</script><div class="highlight"><pre><code class="javascript"><span class="keyword">var</span> UD = require(<span class="string">'uxcore-dropdown'</span>);
<span class="keyword">var</span> Dropdown = UD.Dropdown;
<span class="keyword">var</span> Menu = UD.Menu;
<span class="keyword">var</span> menu = <span class="xml"><span class="tag"><<span class="title">Menu</span>></span>
<span class="tag"><<span class="title">Menu.Item</span> <span class="attribute">key</span>=<span class="value">"0"</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.alipay.com/"</span>></span>第一个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Item</span> <span class="attribute">key</span>=<span class="value">"1"</span>></span>
<span class="tag"><<span class="title">a</span> <span class="attribute">target</span>=<span class="value">"_blank"</span> <span class="attribute">href</span>=<span class="value">"http://www.taobao.com/"</span>></span>第二个菜单项<span class="tag"></<span class="title">a</span>></span>
<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"><<span class="title">Menu.Divider</span>/></span>
<span class="tag"><<span class="title">Menu.Item</span> <span class="attribute">key</span>=<span class="value">"3"</span> <span class="attribute">disabled</span>></span>第三个菜单项(不可用)<span class="tag"></<span class="title">Menu.Item</span>></span>
<span class="tag"></<span class="title">Menu</span>></span>;</span>
ReactDOM.render(
<span class="xml"><span class="tag"><<span class="title">Dropdown</span> <span class="attribute">overlay</span>=<span class="value">{menu}</span>></span>
<span class="tag"><<span class="title">button</span> <span class="attribute">className</span>=<span class="value">"kuma-button kuma-button-sblue"</span>></span>分割线和不可用菜单项<span class="tag"></<span class="title">button</span>></span>
<span class="tag"></<span class="title">Dropdown</span>></span>,
document.getElementById('components-dropdown-demo-other')
);</span></code></pre></div></div></div></article></div></body></html>