简体   繁体   English

如何禁用反应选择上的输入?

[英]How to disable input on react-select?

How to disable input on react-select ?如何禁用react-select上的输入? Is that possible?那可能吗? I just want it to be a dropdown.我只是希望它是一个下拉菜单。

<Select
    placeholder="Action"
    className="col-3 mt-3"
    value={orderStatusInput}
    onChange={this.onOrderStatusChange}
    options={orderStatusOptions}
/>

在此处输入图像描述

To make React Select act as a dropdown使 React Select 充当下拉菜单

export default function App() {
  return (
    <div>
      <ReactSelect isSearchable={false} />
    </div>
  );
}

If you want the search input to be disabled and just want it to be a dropdown, you can set the isSearchable property to false :如果您希望禁用搜索输入并且只希望它是一个下拉列表,您可以将isSearchable属性设置为false

<Select
  placeholder="Action"
  className="col-3 mt-3"
  value={orderStatusInput}
  onChange={this.onOrderStatusChange}
  options={orderStatusOptions}
  isSearchable={false}
/>

<Select isDisabled={true} />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM