const remote = electron.remote; btn_refresh.addEventListener('click', (e) => { const filepath =remote.dialog.showSaveDialog(remote.getCurrentWindow(), { // 过滤文件类型 filters: [{ name: "xls Files", extensions: ['xlsx'] }, { name: 'All Files', extensions: ['*'] } ] }); console.log(filepath); });
运行一下,点击刷新验证码按钮就可以看到熟悉的系统对话框