Skip to content

Commit

Permalink
fix(Select): add api menuProps for menu. close #1141
Browse files Browse the repository at this point in the history
  • Loading branch information
bindoon committed Oct 9, 2019
1 parent 7c98e1c commit 38fed47
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/select/base.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export default class Base extends React.Component {
* 自定义弹层的内容
*/
popupContent: PropTypes.node,
/**
* 添加到菜单上的属性
*/
menuProps: PropTypes.object,
/**
* 是否使用本地过滤,在数据源为远程的时候需要关闭此项
*/
Expand Down Expand Up @@ -396,6 +400,7 @@ export default class Base extends React.Component {
locale,
notFoundContent,
useVirtual,
menuProps,
} = this.props;
const { dataSource, highlightKey } = this.state;
const value = this.state.value;
Expand Down Expand Up @@ -424,7 +429,8 @@ export default class Base extends React.Component {
);
}

const menuProps = {
const customProps = {
...menuProps,
children,
role: 'listbox',
selectedKeys,
Expand Down Expand Up @@ -455,7 +461,7 @@ export default class Base extends React.Component {
ref(c);
this.menuRef = c;
}}
{...menuProps}
{...customProps}
>
{items}
</Menu>
Expand All @@ -466,7 +472,7 @@ export default class Base extends React.Component {
</VirtualList>
</div>
) : (
<Menu {...menuProps} style={menuStyle} />
<Menu {...customProps} style={menuStyle} />
);
}

Expand Down

0 comments on commit 38fed47

Please sign in to comment.