如何增加 select 菜单内容的高度?
How do you increase the select menu content height?
编辑:
沙盒:https://codesandbox.io/s/clever-leftpad-dkjh7?file=/index.js:0-1748
我正在使用 React,evergreen-ui SelectMenu
组件。
使用组件 titleView
属性 的问题在于,当 header 高度较高时,某些 select 菜单项无法正确呈现(隐藏) .
据说在上图中,“hhhhhhh”应该显示但被隐藏了。
public render() {
const { children } = this.props;
let options = [];
options.push({ label: '00000000', value: '00000000' });
options.push({ label: '11111111', value: '11111111' });
options.push({ label: '22222222', value: '22222222' });
options.push({ label: 'aaaaaaaa', value: 'aaaaaaaa' });
options.push({ label: 'bbbbbbbb', value: 'bbbbbbbb' });
options.push({ label: 'cccccccc', value: 'cccccccc' });
options.push({ label: 'dddddddd', value: 'dddddddd' });
options.push({ label: 'eeeeeeee', value: 'eeeeeeee' });
options.push({ label: 'ffffffff', value: 'ffffffff' });
options.push({ label: 'gggggggg', value: 'gggggggg' });
options.push({ label: 'hhhhhhhh', value: 'hhhhhhhh' });
return (
<SelectMenu
className={'someClassName'}
filterPlaceholder={'Filter by name...'}
isMultiSelect={true}
titleView={this.getCustomTitleView}
hasTitle={true}
hasFilter={true}
options={...options}
onSelect={this.onDeviceSelectHandler}
onDeselect={this.onDeviceDeselectHandler}
>
{children}
</SelectMenu>
);
}
private getCustomTitleView() {
return (
<Pane
display="flex"
flexDirection="column"
borderBottom="default"
padding={8}
boxSizing="border-box"
>
<Heading size={400}>{this.props.title}</Heading>
<Pane marginTop={5}>
<Button width={'100%'} justifyContent="center">
Clear all selections
</Button>
</Pane>
</Pane>
);
}
我已经尝试向组件添加 className
属性 以使用以下 CSS (见下文)希望它会动态增加高度但到目前为止没用。
.someClassName:nth-of-type(1) {
height: 285px;
}
然而,通过控制台手动添加它是可行的:
编辑:
沙盒:https://codesandbox.io/s/clever-leftpad-dkjh7?file=/index.js:0-1748
我正在使用 React,evergreen-ui SelectMenu
组件。
使用组件 titleView
属性 的问题在于,当 header 高度较高时,某些 select 菜单项无法正确呈现(隐藏) .
据说在上图中,“hhhhhhh”应该显示但被隐藏了。
public render() {
const { children } = this.props;
let options = [];
options.push({ label: '00000000', value: '00000000' });
options.push({ label: '11111111', value: '11111111' });
options.push({ label: '22222222', value: '22222222' });
options.push({ label: 'aaaaaaaa', value: 'aaaaaaaa' });
options.push({ label: 'bbbbbbbb', value: 'bbbbbbbb' });
options.push({ label: 'cccccccc', value: 'cccccccc' });
options.push({ label: 'dddddddd', value: 'dddddddd' });
options.push({ label: 'eeeeeeee', value: 'eeeeeeee' });
options.push({ label: 'ffffffff', value: 'ffffffff' });
options.push({ label: 'gggggggg', value: 'gggggggg' });
options.push({ label: 'hhhhhhhh', value: 'hhhhhhhh' });
return (
<SelectMenu
className={'someClassName'}
filterPlaceholder={'Filter by name...'}
isMultiSelect={true}
titleView={this.getCustomTitleView}
hasTitle={true}
hasFilter={true}
options={...options}
onSelect={this.onDeviceSelectHandler}
onDeselect={this.onDeviceDeselectHandler}
>
{children}
</SelectMenu>
);
}
private getCustomTitleView() {
return (
<Pane
display="flex"
flexDirection="column"
borderBottom="default"
padding={8}
boxSizing="border-box"
>
<Heading size={400}>{this.props.title}</Heading>
<Pane marginTop={5}>
<Button width={'100%'} justifyContent="center">
Clear all selections
</Button>
</Pane>
</Pane>
);
}
我已经尝试向组件添加 className
属性 以使用以下 CSS (见下文)希望它会动态增加高度但到目前为止没用。
.someClassName:nth-of-type(1) {
height: 285px;
}
然而,通过控制台手动添加它是可行的: