小编典典

将示例文件下载到公用文件夹中(反应)

reactjs

我想将样本xlsx文件放入我的公用文件夹(反应项目)中,其他人可以下载此文件。

<Button><link rel="chargeSample" href="%PUBLIC_URL%/chargeSample.xlsx"></link></Button>

我怎样才能做到这一点?


阅读 252

收藏
2020-07-22

共1个答案

小编典典

标签定义文档和外部资源之间的链接。要在您的网站上下载功能,您应该更改链接标签

import chargeSample from './public/chargeSample.xlsx';

<Button><a href={chargeSample} download="your file name">Download</a></Button>
2020-07-22