0

我正在使用react-select-fast-filter-optionsselect并在搜索任何内容时,即使标签中存在针对它的条目,我也没有得到任何结果。

我已经看到了这个问题,我面临着一个非常相似的问题,但我没有将任何非默认属性传递给react-virtualized-select.

我的代码如下:

import "react-select/dist/react-select.css";

import React from "react";
import ReactDOM from "react-dom";
import createFilterOptions from "react-select-fast-filter-options";
import Select from "react-select";
import faker from "faker";

// Dummy array of test values.
const options = Array.from(new Array(100), (_, index) => ({
  label: faker.lorem.sentence(),
  value: index
}));

export default class SelectComponent extends React.Component {
  render() {
    console.log(this.props.alloptions);
    return (
      <Select
        options={this.props.alloptions}
        filterOptions={createFilterOptions(this.props.alloptions)}
      />
    );
  }
}

ReactDOM.render(
  <SelectComponent alloptions={options} />,
  document.getElementById("root")
);

我的猜测是,我执行的数据索引react-select-fast-filter-options是使用一些我不知道的隐藏字段完成的。

有什么我想念的吗?

4

1 回答 1

0

当我将您问题中的代码放入代码框时,它的代码工作得非常好。

https://codesandbox.io/s/vibrant-wind-rlp2i?fontsize=14&view=preview

于 2019-06-21T08:13:37.880 回答