【问题标题】:react-multi-select-component is not working as expected in IE 11react-multi-select-component 在 IE 11 中未按预期工作
【发布时间】:2021-01-01 00:16:36
【问题描述】:

以下是示例代码,该示例在除 IE11 之外的所有其他浏览器中都能正常工作。此下拉菜单在单击后立即关闭。下拉列表不显示。

import React, { useState } from "react";
import MultiSelect from "react-multi-select-component";
const Example: React.FC = () => {
const options = [{ label:"grpes", value: "grapes" },{  label:"mango",value: "mango" }];
const [selected, setSelected] = useState([]);
return (
    <div>
      <h1>Select Fruits</h1>
      <pre>{JSON.stringify(selected)}</pre>
<MultiSelect
        options={options}
        value={selected}
        onChange={setSelected}
        labelledBy={"Select"}
      />
 </div>
  );
};
 
export default Example;

【问题讨论】:

  • 嗨 shantih.antony,欢迎来到 Stackoverflow。可以分享您的其余代码吗?
  • 我已按要求更新了代码
  • @Alireza 请检查更新后的代码
  • 无法从我的脑海中找出问题所在。似乎还搜索了包的问题,​​但没有找到任何可能解决您的问题的东西。对不起。
  • 没有问题,感谢您关注这个

标签: reactjs npm internet-explorer-11 multi-select


【解决方案1】:

由于react-multi-select-component 下拉菜单与IE 不兼容,我使用了以下下拉菜单,它与react-multi-select-component 具有相似的功能。

组件名称:react-multiselect-checkboxes

https://www.npmjs.com/package/react-multiselect-checkboxes

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多