Skip to content

Commit

Permalink
feat: 支持部分选项 hidden 隐藏属性
Browse files Browse the repository at this point in the history
  • Loading branch information
砚心 committed Apr 15, 2020
1 parent f19f309 commit cd5d4ff
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions demo/CascadeSelectDemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,28 @@ const asyncOptions = [
const options6 =
[{ "label": "小蕨1", "value": "小蕨1", "children": [{ "label": "小蕨2", "value": "小蕨2", "children": [{ "label": "小蕨3", "value": "小蕨3", "children": [{ "label": "小蕨4", "value": "小蕨4", "children": [{ "label": "小蕨5", "value": "小蕨5", "children": [{ "label": "小蕨6", "value": "小蕨6", "children": [] }] }] }] }] }] }];

const options7 = [{
"value": "1",
"code": "A50",
"label": "[测试] 阿里巴巴(中国)有限公司",
"children": [{
"value": "1-1",
"code":
"A50-1",
"label": "[测试]信息平台事业部",
"hidden": true
}]
}, {
"value": "2",
"code": "A51",
"label": "[测试] 蚂蚁金服有限公司",
"children": [{
"value": "2-1",
"code": "A51-1",
"label": "[测试]花呗事业部",
"hidden": true
}]
}]; // eslint-disable-line
const optionsGenerator = (key, level) => {
const childrenOptions = [];
for (let i = 0; i <= level; i += 1) {
Expand Down Expand Up @@ -550,6 +572,18 @@ class Demo extends React.Component {
设置底层叶子节点
</button>

<h2>隐藏部分 Options</h2>
<CascadeSelect
value={this.state.xValue3}
options={options7}
clearable
onChange={(value, selected) => {
this.setState({ xValue3: value });
}}
cascadeSize={2}
showSearch
cascaderHeight={200}
/>
<h2>单独使用面板</h2>
<CascadeSelect.CascadeSubmenu
options={options}
Expand Down
1 change: 1 addition & 0 deletions src/CascadeSubmenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class CascadeSubmenu extends SuperComponent {
<li
key={item.value}
title={item.label}
style={{ display: item.hidden ? 'none': 'block' }}
className={classnames({ active: item.value === key })}
{...otherProps}
>
Expand Down

0 comments on commit cd5d4ff

Please sign in to comment.