反应材质ui自动完成挂钩 [英] React material ui autocomplete hooks

查看:66
本文介绍了反应材质ui自动完成挂钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在react中使用了实质性的UI自动完成功能,并且工作正常.

I'm using the material UI autocomplete in react and it's working fine.

但是,我不知道如何获取所选项目的对象.例如,我想搜索一个人,然后将该项目添加到对象数组和表中.人员对象,包括姓名,电子邮件等.

However, I can't figure out how to get the object of the selected item. Ex I want to search for a person and then add that item to an array of objects, and into a table. The person object including name, email and so on.

而且我似乎找不到任何示例.

And I can't seem to find any examples of this.

我的代码如下: 我的代码

我正在尝试: https://material-ui.com/components/autocomplete/

有人对此有一个想法吗?我很新来做出反应.

Does anyone have an Idé on how to do this? I'm pretty new to react.

推荐答案

您可以使用自动完成功能的onChange属性,并在选项数组中按ID查找对象.

You can use onChange property of Autocomplete and find object by id in the array of options.

这篇关于反应材质ui自动完成挂钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆