当使用@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
复制相似问题