如何在React的Material UI简单输入上启用文件上传? [英] How to enable file upload on React's Material UI simple input?

查看:849
本文介绍了如何在React的Material UI简单输入上启用文件上传?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个简单的表单,以使用带有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简单输入上启用文件上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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