Select component fuzzy search option

const handleSearch = (input: any, option: any) => {
    
    
    if (option && option.props && option.props.children) {
    
    
      return (
        option.props.children === input ||
        option.props.children.indexOf(input) !== -1
      );
    } else {
    
    
      return true;
    }
  };




 <Select
  showSearch
  allowClear
  placeholder=""
  filterOption={
    
    (input, option) =>
    handleSearch(input, option)
  }
  className={
    
    styles.selectArea}
>
  /*option内容*/
</Select>

Guess you like

Origin blog.csdn.net/sunzhen15896/article/details/114267125