[浏览某些教程时,我在anchor
中遇到了ReactJS
标记的两个实现
<a id="newtD" download={'Report'} href='./reports/product/myTest.xlsx' display = "none"></a>
<a id="newtD" download={'Report'} href={require('./reports/product/myTest.xlsx')} display = "none"></a>
因此,require
中此href
属性的意义是什么?
感谢。
可以使用相对路径(例如./、./foo、./bar/baz、../foo)导入本地模块和JSON文件,该相对路径将针对__dirname(如果已定义)或当前工作目录。