afc163
9 years ago
17 changed files with 170 additions and 30 deletions
@ -0,0 +1,47 @@ |
|||
# 大小 |
|||
|
|||
- order: 7 |
|||
|
|||
不同大小的级联选择器。 |
|||
|
|||
--- |
|||
|
|||
````jsx |
|||
import { Cascader } from 'antd'; |
|||
|
|||
const options = [{ |
|||
value: 'zhejiang', |
|||
label: '浙江', |
|||
children: [{ |
|||
value: 'hangzhou', |
|||
label: '杭州', |
|||
children: [{ |
|||
value: 'xihu', |
|||
label: '西湖', |
|||
}], |
|||
}], |
|||
}, { |
|||
value: 'jiangsu', |
|||
label: '江苏', |
|||
children: [{ |
|||
value: 'nanjing', |
|||
label: '南京', |
|||
children: [{ |
|||
value: 'zhonghuamen', |
|||
label: '中华门', |
|||
}], |
|||
}], |
|||
}]; |
|||
|
|||
function onChange(value) { |
|||
console.log(value); |
|||
} |
|||
|
|||
ReactDOM.render( |
|||
<div> |
|||
<Cascader size="large" options={options} onChange={onChange} /><br /><br /> |
|||
<Cascader options={options} onChange={onChange} /><br /><br /> |
|||
<Cascader size="small" options={options} onChange={onChange} /><br /><br /> |
|||
</div> |
|||
, mountNode); |
|||
```` |
@ -0,0 +1,80 @@ |
|||
# 大小 |
|||
|
|||
- order: 2 |
|||
|
|||
不同大小的 TreeSelect。 |
|||
|
|||
--- |
|||
|
|||
````jsx |
|||
import { TreeSelect } from 'antd'; |
|||
const TreeNode = TreeSelect.TreeNode; |
|||
|
|||
const Demo = React.createClass({ |
|||
getInitialState() { |
|||
return { |
|||
value: 'leaf1', |
|||
}; |
|||
}, |
|||
onChange(value) { |
|||
this.setState({ value }); |
|||
}, |
|||
render() { |
|||
return ( |
|||
<div> |
|||
<TreeSelect size="large" style={{width: 180}} showSearch |
|||
value={this.state.value} optionLabelProp="title" |
|||
dropdownMenuStyle={{maxHeight: 200, overflow: 'auto'}} |
|||
treeDefaultExpandAll |
|||
onChange={this.onChange}> |
|||
<TreeNode value="parent 1" title="parent 1" key="0-1"> |
|||
<TreeNode value="parent 1-0" title="parent 1-0" key="0-1-1"> |
|||
<TreeNode value="leaf1" title="my leaf" key="random" /> |
|||
<TreeNode value="leaf2" title="your leaf" key="random1" /> |
|||
</TreeNode> |
|||
<TreeNode value="parent 1-1" title="parent 1-1" key="random2"> |
|||
<TreeNode value="sss" title="sss" key="random3" /> |
|||
</TreeNode> |
|||
</TreeNode> |
|||
</TreeSelect> |
|||
<br /><br /> |
|||
<TreeSelect style={{width: 180}} showSearch |
|||
value={this.state.value} optionLabelProp="title" |
|||
dropdownMenuStyle={{maxHeight: 200, overflow: 'auto'}} |
|||
treeDefaultExpandAll |
|||
onChange={this.onChange}> |
|||
<TreeNode value="parent 1" title="parent 1" key="0-1"> |
|||
<TreeNode value="parent 1-0" title="parent 1-0" key="0-1-1"> |
|||
<TreeNode value="leaf1" title="my leaf" key="random" /> |
|||
<TreeNode value="leaf2" title="your leaf" key="random1" /> |
|||
</TreeNode> |
|||
<TreeNode value="parent 1-1" title="parent 1-1" key="random2"> |
|||
<TreeNode value="sss" title="sss" key="random3" /> |
|||
</TreeNode> |
|||
</TreeNode> |
|||
</TreeSelect> |
|||
<br /><br /> |
|||
<TreeSelect size="small" style={{width: 180}} showSearch |
|||
value={this.state.value} optionLabelProp="title" |
|||
dropdownMenuStyle={{maxHeight: 200, overflow: 'auto'}} |
|||
treeDefaultExpandAll |
|||
onChange={this.onChange}> |
|||
<TreeNode value="parent 1" title="parent 1" key="0-1"> |
|||
<TreeNode value="parent 1-0" title="parent 1-0" key="0-1-1"> |
|||
<TreeNode value="leaf1" title="my leaf" key="random" /> |
|||
<TreeNode value="leaf2" title="your leaf" key="random1" /> |
|||
</TreeNode> |
|||
<TreeNode value="parent 1-1" title="parent 1-1" key="random2"> |
|||
<TreeNode value="sss" title="sss" key="random3" /> |
|||
</TreeNode> |
|||
</TreeNode> |
|||
</TreeSelect> |
|||
</div> |
|||
); |
|||
}, |
|||
}); |
|||
|
|||
ReactDOM.render( |
|||
<Demo /> |
|||
, mountNode); |
|||
```` |
Loading…
Reference in new issue