我正在尝试在电子应用程序中上传一个文件,该文件非常适用于电子 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)