Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchSelect 搜索选择器,option为空数组,value有值时报错 #565

Closed
star-hamster opened this issue Feb 28, 2022 · 2 comments
Closed

Comments

@star-hamster
Copy link
Contributor

SearchSelect存在默认值时,如果option没有数据,就会报错

import ReactDOM from 'react-dom';
import { SearchSelect } from 'uiw';

const Demo = () => {
  const selectOption=[]

  const [option, setOption] = React.useState(selectOption);
  const [loading, setLoading] = React.useState(false);
  const [value, setValue] = React.useState([8]);
  function handleSearch(e) {
    setLoading(true)
    setTimeout(() =>  {
      setOption();
      setLoading(false);
    }, 2000);
  }
  return(
    <SearchSelect
      mode="multiple"
      style={{ width: 176 }}
      showSearch={true}
      maxTagCount={6}
      allowClear
      value={value}
      disabled={false}
      placeholder="请输入选择"
      onSearch={handleSearch}
      // onSelect={(value)=>console.log('onSelect',value)}
      loading={loading}
      option={option}
      onChange={(value) => {
        console.log('value',value)
        setValue(value)
      }}
    />
  );
};
ReactDOM.render(<Demo />, _mount_);

image

@nullptr-z
Copy link
Collaborator

@didiboji 相关修复已经提交,加★及时获取相关发布动态

@jaywcjlove
Copy link
Member

@nullptr-z @didiboji Upgrade uiw@4.13.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants