【发布时间】:2021-03-26 05:15:30
【问题描述】:
我知道如何在使用 html 点击按钮时下载文件
<a href="./abcf32x.pdf" download="How-to-download-file.pdf">
<button>Download File</button>
</a>
但是使用 Material-UI 组件我该怎么做
我有以下组件
<div>
<Button
variant="contained"
color="#ffa726"
size="large"
startIcon={<GetAppIcon />}
>
Download Sample Method File
</Button>
</div>
现在我想下载一个url为http://localhost:8000/static/sample_method.py的文件
我不想在浏览器中打开链接然后另存为,而是应该直接下载。
【问题讨论】:
标签: reactjs material-ui