我打电话dialog.showOpenDialog()来寻找文件夹的路径。但问题是这不会阻止mainWindow. 需要在标准路径选择GUI出现时,程序只有在路径选择完成后才能继续工作。谷歌搜索并意识到您需要使用remote. 但什么也没有发生。
我得到:
无法解构“未定义”或“空”的属性对话框。如果来自electron.remote 进行对话。
我尝试了很多不同的东西(这些并不是所有的尝试,只是我记得的):
const { dialog } = require ('electron').remote;
var remote = electron.remote;
var dialog = remote.dialog;
const dialog = require ('electron').remote.dialog;
Run Code Online (Sandbox Code Playgroud)
我试图连接很多,但。
我的 main.js:
const url = require('url');
const path = require('path');
const {dialog} = electron.remote;
const {app, BrowserWindow, Menu} = electron;
app.on('ready', function () {
const {start_width, start_height} = electron.screen.getPrimaryDisplay().workAreaSize;
mainWindow = new BrowserWindow({
minWidth: 1250,
minHeight: 800,
height: start_height,
width: start_width,
center: …Run Code Online (Sandbox Code Playgroud) electron ×1