ts 错误修复
This commit is contained in:
parent
ad00c8f34f
commit
794ac5f6bc
|
@ -760,11 +760,10 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|||
const itemHeight = this.state.itemHeight;
|
||||
|
||||
// 渲染单个选项
|
||||
const renderItem = ({index, style}) => {
|
||||
const renderItem = ({index, style}: {index: number; style?: object}) => {
|
||||
const item = filtedOptions[index];
|
||||
const checked =
|
||||
selectedItem === item ||
|
||||
!!~selectionValues.indexOf(item[valueField]);
|
||||
selectedItem === item || !!~selectionValues.indexOf(item[valueField]);
|
||||
return (
|
||||
<div
|
||||
{...getItemProps({
|
||||
|
@ -835,7 +834,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const menu = (
|
||||
<div ref={this.menu} className={cx('Select-menu')}>
|
||||
|
@ -879,13 +878,18 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|||
filtedOptions.length > 100 ? ( // 超过 100 个数据才启用 virtuallist 避免滚动条问题
|
||||
<VirtualList
|
||||
height={
|
||||
filtedOptions.length > 8 ? 280 : filtedOptions.length * itemHeight
|
||||
filtedOptions.length > 8
|
||||
? 280
|
||||
: filtedOptions.length * itemHeight
|
||||
}
|
||||
itemCount={filtedOptions.length}
|
||||
itemSize={itemHeight}
|
||||
renderItem={renderItem}
|
||||
/>): (
|
||||
filtedOptions.map((item, index) => { return renderItem({index}) })
|
||||
/>
|
||||
) : (
|
||||
filtedOptions.map((item, index) => {
|
||||
return renderItem({index});
|
||||
})
|
||||
)
|
||||
) : (
|
||||
<div className={cx('Select-noResult')}>{__(noResultsText)}</div>
|
||||
|
|
Loading…
Reference in New Issue