小编Was*_*tab的帖子

电子 v10.1.1 给出未捕获的类型错误:无法读取未定义的属性“对话框”,但相同的代码在电子 v9.3.0 中有效

我正在尝试在电子应用程序中上传一个文件,该文件非常适用于电子 v9.3.0,但是一旦我使用电子 v10.1.1,它就会Uncaught TypeError: Cannot read property 'dialog' of undefined在这一行出现以下错误 ,const dialog = electron.remote.dialog;请参见下面的屏幕截图。 在此处输入图片说明

main.js 的内容如下

const { app, BrowserWindow } = require('electron') 

function createWindow () { 
// Create the browser window. 
const win = new BrowserWindow({ 
    width: 800, 
    height: 600, 
    webPreferences: { 
    nodeIntegration: true
    } 
}) 

// Load the index.html of the app. 
win.loadFile('src/index.html') 

// Open the DevTools. 
win.webContents.openDevTools() 
} 

// This method will be called when Electron has finished 
// initialization and is ready …
Run Code Online (Sandbox Code Playgroud)

javascript electron

7
推荐指数
3
解决办法
3018
查看次数

标签 统计

electron ×1

javascript ×1