问题描述
我正在创建一个简单的表单,以使用带有redux表单&的电子反应样板上传文件物质用户界面.
I am creating a simple form to upload file using electron-react-boilerplate with redux form & material ui.
问题是我不知道如何创建输入文件字段,因为材料ui不支持上传文件输入.
The problem is that I do not know how to create input file field because material ui does not support upload file input.
关于如何实现这一目标的任何想法?
Any ideas on how to achieve this?
推荐答案
另一个在我看来比@galki解决方案更有意义的> = v1.0解决方案.
Another >=v1.0 solution that makes more sense to me structurally than @galki's solution.
RaisedButton
在> = v1.0中已弃用.我找不到有关containerElement
的更多信息(它可能尚未记录?),但是当前的API为此提供了component
.
RaisedButton
is deprecated in >=v1.0. I cannot find more information on containerElement
(it may have been undocumented?) but the current API provides component
for this purpose.
<Button
variant="contained"
component="label"
>
Upload File
<input
type="file"
style={{ display: "none" }}
/>
</Button>
这篇关于如何在React的Material UI简单输入上启用文件上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!