有没有办法限制 Material UI 输入类型 = 文件的 TextFields 只接受 pdf?

Is there a way to limit Material UI TextFields of input type = file to accept only pdf?

我试图让我的输入类型=文件来限制用户只能上传 pdf。

我查了一下,发现使用 accept 属性会有帮助。但它无法使用 material UI 文本字段。

我可以尝试任何解决方案吗?

你试过这个吗:

<TextField type={"file"} inputProps={{accept:"application/pdf"}}/>