搜索结果中将忽略只有一个单词的字段。
const [input, setInput] = useState("");
const data = [
{ name: "LOL" },
{ name: "PUBG" },
{ name: "PlayerUnknown's Battlegrounds" },
{ name: "League of legends" },
];
const handleOnChange = (e) => {
e.preventDefault();
setInput(e.target.value);
};
const fuse = new Fuse(data, {
keys: ["name"],
shouldSort: true
});
const results = fuse.search(!input ? " " : input);
如何解决?提前致谢。