当使用@electron/remote
时,remote.getCurrentWindow()
的结果缺少窗口的所有附加属性/方法,这些属性/方法可以从main
进程访问,而在使用remote.getCurrentWindow()
与内置remote
一起使用时,这些属性/方法也是可以访问的。例如:
@electron/remote
const remote = require('@electron/remote');
console.log(remote.getCurrentWindow().isFullScreen); // undefined
原始远程模块
const { remote } = require('electron');
console.log(remote.getCurrentWindow().isFullScreen); // true/false
行为差异的原因是什么?我能找到的任何地方都没有记录。
发布于 2022-06-17 08:04:12
把nodeIntegration: true
contextIsolation: false
放在webPreferences
of mainWindow中。也许这就是问题所在。
https://stackoverflow.com/questions/72652218
复制相似问题