Reactjs 设置文件下载路径
我正在用electron和reactjs创建一个应用程序。在该应用程序中,我想创建一个组件,供用户选择文件下载路径。使用react是否可行?我如何才能完成此任务?您可以通过以下方式轻松完成此任务:Reactjs 设置文件下载路径,reactjs,file,path,electron,Reactjs,File,Path,Electron,我正在用electron和reactjs创建一个应用程序。在该应用程序中,我想创建一个组件,供用户选择文件下载路径。使用react是否可行?我如何才能完成此任务?您可以通过以下方式轻松完成此任务: <button type="button" onClick={this.handleSetDownloadPath}>Set Download Path</button> import { remote } from "electron"; ... handleSetDo
<button type="button" onClick={this.handleSetDownloadPath}>Set Download Path</button>
import { remote } from "electron";
...
handleSetDownloadPath = () => {
remote.dialog.showOpenDialog(
{
properties: ["openDirectory"]
},
files => {
if (files) {
this.setState({
downloadPath: files[0]
});
}
}
);
};