upgrade select. Fixes #170

This commit is contained in:
yiminghe 2015-08-20 17:27:40 +08:00
parent d2e7253c51
commit 0a1cfccd22
10 changed files with 27 additions and 17 deletions

View File

@ -15,7 +15,7 @@ function handleChange(value) {
}
React.render(
<Select value="lucy" style={{width:200}} onChange={handleChange}>
<Select defaultValue="lucy" style={{width:200}} onChange={handleChange}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="disabled" disabled>Disabled</Option>

View File

@ -20,12 +20,19 @@ var cityData = {
var App = React.createClass({
getInitialState() {
return {
cities: cityData[provinceData[0]]
cities: cityData[provinceData[0]],
secondCity:cityData[provinceData[0]][0]
};
},
handleProvinceChange(value) {
this.setState({
cities: cityData[value]
cities: cityData[value],
secondCity:cityData[value][0]
});
},
onSecondCityChange(value) {
this.setState({
secondCity: value
});
},
render() {
@ -40,7 +47,7 @@ var App = React.createClass({
{provinceOptions}
</Select>
&nbsp;
<Select value={this.state.cities[0]} style={{width:150}} onChange={this.handleCityChange}>
<Select value={this.state.secondCity} style={{width:150}} onChange={this.onSecondCityChange}>
{cityOptions}
</Select>
</div>;

View File

@ -23,7 +23,7 @@ function handleChange(value) {
React.render(
<Select multiple
style={{width:400}}
value={['a10', 'c12']} onChange={handleChange}>
defaultValue={['a10', 'c12']} onChange={handleChange}>
{children}
</Select>
, document.getElementById('components-select-demo-multiple'));

View File

@ -16,7 +16,7 @@ function handleChange(value) {
}
React.render(
<Select value="lucy"
<Select defaultValue="lucy"
style={{width:200}}
showSearch={false}
onChange={handleChange}>

View File

@ -15,7 +15,7 @@ function handleChange(value) {
}
React.render(
<Select value="lucy" showSearch={true} style={{width:200}} onChange={handleChange}>
<Select defaultValue="lucy" showSearch={true} style={{width:200}} onChange={handleChange}>
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
<Option value="disabled" disabled>disabled</Option>

View File

@ -16,19 +16,19 @@ function handleChange(value) {
React.render(
<div>
<Select size="large" value="lucy" style={{width:200}} onChange={handleChange}>
<Select size="large" defaultValue="lucy" style={{width:200}} onChange={handleChange}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="disabled" disabled>Disabled</Option>
<Option value="yiminghe">yiminghe</Option>
</Select>
<Select value="lucy" style={{width:200}} onChange={handleChange}>
<Select defaultValue="lucy" style={{width:200}} onChange={handleChange}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="disabled" disabled>Disabled</Option>
<Option value="yiminghe">yiminghe</Option>
</Select>
<Select size="small" value="lucy" style={{width:200}} onChange={handleChange}>
<Select size="small" defaultValue="lucy" style={{width:200}} onChange={handleChange}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="disabled" disabled>Disabled</Option>
@ -42,4 +42,4 @@ React.render(
.ant-select{
margin: 0 10px 10px 0;
}
````
````

View File

@ -23,7 +23,7 @@ function handleChange(value) {
React.render(
<Select
style={{width:400}}
tags value={['name2', 'name3']} onChange={handleChange}>
tags defaultValue={['name2', 'name3']} onChange={handleChange}>
{children}
</Select>
, document.getElementById('components-select-demo-tags'));

View File

@ -24,7 +24,7 @@
| 参数 | 说明 | 类型 | 默认值 |
|----------|----------------|----------|--------------|
| value | 指定选中的条目 | string/Array<String> | 无 |
| value | 指定当前选中的条目 | string/Array<String> | 无 |
| defaultValue | 指定默认选中的条目 | string/Array<String> | 无 |
| multiple | 支持多选 | | false |
| filterOption | 是否根据输入项进行筛选 | | true |

View File

@ -38,6 +38,7 @@
"gregorian-calendar-format": "~3.0.1",
"is-equal-shallow": "~0.1.3",
"object-assign": "3.x",
"rc-animate": "~1.1.0",
"rc-calendar": "~3.13.0",
"rc-checkbox": "~1.1.1",
"rc-collapse": "~1.2.3",
@ -50,7 +51,7 @@
"rc-pagination": "~1.1.0",
"rc-progress": "~1.0.0",
"rc-radio": "~2.0.0",
"rc-select": "~4.7.1",
"rc-select": "~4.8.0",
"rc-slider": "~1.4.0",
"rc-steps": "~1.1.4",
"rc-switch": "~1.2.0",
@ -61,8 +62,7 @@
"rc-upload": "~1.3.1",
"rc-util": "~2.0.3",
"react-slick2": "~0.6.6",
"reqwest": "~2.0.1",
"rc-animate": "~1.1.0"
"reqwest": "~2.0.1"
},
"devDependencies": {
"autoprefixer-loader": "~2.0.0",
@ -83,6 +83,7 @@
"lodash": "^3.10.0",
"nico-jsx": "~0.5.8",
"precommit-hook": "^1.0.7",
"rc-tabs": "~5.3.3",
"webpack": "^1.10.1",
"webpack-dev-middleware": "^1.2.0"
},

View File

@ -291,7 +291,9 @@
}
&-dropdown {
display: none;
&-hidden {
display: none;
}
background-color: white;
border: 1px solid #d9d9d9;
box-shadow: @overlay-shadow;