材料UI自动完成:用户输入时获取更新的选项列表

发布于 2025-02-11 21:54:37 字数 925 浏览 0 评论 0原文

我正在使用材料UI自动完成,并且我想在用户键入时在下拉列表中显示新的过滤列表。

就像在第一张图片中一样,我们有完整列表:

”在此处输入图像描述

在此处结束我们在用户键入“ Amer”之后的更新列表(3个元素);

有没有办法获取新列表的元素?

自动完成代码:

<Autocomplete
        freeSolo
        id="free-solo-2-demo"
        disableClearable
        options={top100Films.map((option) => option.title)}
        renderInput={(params) => (
          <TextField
            {...params}
            label="Search input"
            InputProps={{
              ...params.InputProps,
              type: 'search',
            }}
          />
        )}
/>

I'm using material ui autocomplete, and i want to get the new filtered list shown in the dropdown while user is typing .

like in first image we have the full list :

enter image description here

end here we have the updated list (3 elements) after user typed "amer" ;

enter image description here

is there a way to get the elements of the new list ?

autocomplete code :

<Autocomplete
        freeSolo
        id="free-solo-2-demo"
        disableClearable
        options={top100Films.map((option) => option.title)}
        renderInput={(params) => (
          <TextField
            {...params}
            label="Search input"
            InputProps={{
              ...params.InputProps,
              type: 'search',
            }}
          />
        )}
/>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文