【问题标题】:MUI autocomplete: How to add user input text into the const list?MUI 自动完成:如何将用户输入文本添加到 const 列表中?
【发布时间】:2022-08-08 14:16:42
【问题描述】:

在 MUI 自动完成组件中,我希望当用户输入一些文本时,我们的系统可以将其保存到列表中,并在用户下次单击时加载列表。

<Autocomplete
id=\"free-solo-demo\"
freeSolo
options={top100Films.map((option) => option.title)}
renderInput={(params) => <TextField {...params} label=\"freeSolo\" />}
      />

现在,免费独奏开放了。用户可以输入他们想要的任何文本。我们如何将它们添加到列表中?

    标签: reactjs material-ui


    【解决方案1】:

    您可以将列表保存在后端,并在获取列表后更新 top100Films 状态的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-31
      • 2016-03-27
      • 2021-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多