Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
3884ee3c
A
ant-design
项目概览
wanjj_1210
/
ant-design
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3884ee3c
编写于
2月 20, 2017
作者:
A
afc163
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rewrite Select demos to es6 component, #4878
上级
c440a4d2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
36 deletion
+31
-36
components/select/demo/combobox.md
components/select/demo/combobox.md
+9
-11
components/select/demo/coordinate.md
components/select/demo/coordinate.md
+13
-14
components/select/demo/search-box.md
components/select/demo/search-box.md
+9
-11
未找到文件。
components/select/demo/combobox.md
浏览文件 @
3884ee3c
...
@@ -22,13 +22,11 @@ Using the [AutoComplete](/components/auto-complete/) component is strongly recom
...
@@ -22,13 +22,11 @@ Using the [AutoComplete](/components/auto-complete/) component is strongly recom
import
{
Select
}
from
'
antd
'
;
import
{
Select
}
from
'
antd
'
;
const
Option
=
Select
.
Option
;
const
Option
=
Select
.
Option
;
const
Test
=
React
.
createClass
({
class
App
extends
React
.
Component
{
getInitialState
()
{
state
=
{
return
{
options
:
[],
options
:
[],
}
};
handleChange
=
(
value
)
=>
{
},
handleChange
(
value
)
{
let
options
;
let
options
;
if
(
!
value
||
value
.
indexOf
(
'
@
'
)
>=
0
)
{
if
(
!
value
||
value
.
indexOf
(
'
@
'
)
>=
0
)
{
options
=
[];
options
=
[];
...
@@ -39,7 +37,7 @@ const Test = React.createClass({
...
@@ -39,7 +37,7 @@ const Test = React.createClass({
});
});
}
}
this
.
setState
({
options
});
this
.
setState
({
options
});
}
,
}
render
()
{
render
()
{
// filterOption needs to be false,as the value is dynamically generated
// filterOption needs to be false,as the value is dynamically generated
return
(
return
(
...
@@ -52,8 +50,8 @@ const Test = React.createClass({
...
@@ -52,8 +50,8 @@ const Test = React.createClass({
{
this
.
state
.
options
}
{
this
.
state
.
options
}
</
Select
>
</
Select
>
);
);
}
,
}
}
);
}
ReactDOM
.
render
(<
Test
/>,
mountNode
);
ReactDOM
.
render
(<
App
/>,
mountNode
);
````
````
components/select/demo/coordinate.md
浏览文件 @
3884ee3c
---
---
order
:
6
order
:
6
title
:
title
:
zh-CN
:
联动
zh-CN
:
联动
en-US
:
coordinate
en-US
:
coordinate
---
---
...
@@ -28,24 +28,22 @@ const cityData = {
...
@@ -28,24 +28,22 @@ const cityData = {
Jiangsu
:
[
'
Nanjing
'
,
'
Suzhou
'
,
'
Zhenjiang
'
],
Jiangsu
:
[
'
Nanjing
'
,
'
Suzhou
'
,
'
Zhenjiang
'
],
};
};
const
App
=
React
.
createClass
({
class
App
extends
React
.
Component
{
getInitialState
()
{
state
=
{
return
{
cities
:
cityData
[
provinceData
[
0
]],
cities
:
cityData
[
provinceData
[
0
]],
secondCity
:
cityData
[
provinceData
[
0
]][
0
],
secondCity
:
cityData
[
provinceData
[
0
]][
0
],
}
};
handleProvinceChange
=
(
value
)
=>
{
},
handleProvinceChange
(
value
)
{
this
.
setState
({
this
.
setState
({
cities
:
cityData
[
value
],
cities
:
cityData
[
value
],
secondCity
:
cityData
[
value
][
0
],
secondCity
:
cityData
[
value
][
0
],
});
});
}
,
}
onSecondCityChange
(
value
)
{
onSecondCityChange
=
(
value
)
=>
{
this
.
setState
({
this
.
setState
({
secondCity
:
value
,
secondCity
:
value
,
});
});
}
,
}
render
()
{
render
()
{
const
provinceOptions
=
provinceData
.
map
(
province
=>
<
Option
key
=
{
province
}
>
{
province
}
</
Option
>);
const
provinceOptions
=
provinceData
.
map
(
province
=>
<
Option
key
=
{
province
}
>
{
province
}
</
Option
>);
const
cityOptions
=
this
.
state
.
cities
.
map
(
city
=>
<
Option
key
=
{
city
}
>
{
city
}
</
Option
>);
const
cityOptions
=
this
.
state
.
cities
.
map
(
city
=>
<
Option
key
=
{
city
}
>
{
city
}
</
Option
>);
...
@@ -59,7 +57,8 @@ const App = React.createClass({
...
@@ -59,7 +57,8 @@ const App = React.createClass({
</
Select
>
</
Select
>
</
div
>
</
div
>
);
);
},
}
});
}
ReactDOM
.
render
(<
App
/>,
mountNode
);
ReactDOM
.
render
(<
App
/>,
mountNode
);
````
````
components/select/demo/search-box.md
浏览文件 @
3884ee3c
...
@@ -54,17 +54,15 @@ function fetch(value, callback) {
...
@@ -54,17 +54,15 @@ function fetch(value, callback) {
timeout
=
setTimeout
(
fake
,
300
);
timeout
=
setTimeout
(
fake
,
300
);
}
}
const
SearchInput
=
React
.
createClass
({
class
SearchInput
extends
React
.
Component
{
getInitialState
()
{
state
=
{
return
{
data
:
[],
data
:
[],
value
:
''
,
value
:
''
,
}
};
handleChange
=
(
value
)
=>
{
},
handleChange
(
value
)
{
this
.
setState
({
value
});
this
.
setState
({
value
});
fetch
(
value
,
data
=>
this
.
setState
({
data
}));
fetch
(
value
,
data
=>
this
.
setState
({
data
}));
}
,
}
render
()
{
render
()
{
const
options
=
this
.
state
.
data
.
map
(
d
=>
<
Option
key
=
{
d
.
value
}
>
{
d
.
text
}
</
Option
>);
const
options
=
this
.
state
.
data
.
map
(
d
=>
<
Option
key
=
{
d
.
value
}
>
{
d
.
text
}
</
Option
>);
return
(
return
(
...
@@ -82,8 +80,8 @@ const SearchInput = React.createClass({
...
@@ -82,8 +80,8 @@ const SearchInput = React.createClass({
{
options
}
{
options
}
</
Select
>
</
Select
>
);
);
}
,
}
}
);
}
ReactDOM
.
render
(
ReactDOM
.
render
(
<
SearchInput
placeholder
=
"input search text"
style
=
{
{
width
:
200
}
}
/>
<
SearchInput
placeholder
=
"input search text"
style
=
{
{
width
:
200
}
}
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录