【发布时间】:2020-10-24 14:48:02
【问题描述】:
创建一个无框窗口,我需要 3 个操作按钮来“关闭”、“最小化”和“最大化”。
我以前是这样创建它们的:
在我的 main.js 中:
function createWindow () {
const mainWindow = new BrowserWindow({
(...)
frame:false,
webPreferences: {
nodeIntegration: true,
(...)
}
})
而在我的页面JS文件里面,我只是用来写的:
const {remote} = require('electron');
function close() {
var window = remote.getCurrentWindow();
window.close();
}
function minimize() {
var window = remote.getCurrentWindow();
window.minimize();
}
它仍然有效.. 但我收到此警告:
"Electron Deprecation Warning The 'remote' module is deprecated and will be disabled in the future version of Electron. 为了确保顺利升级并消除此警告,请在 WebPreferences 中指定 {enableRemoteModule: true}这个窗口。”
而且我真的找不到不使用遥控器来执行此操作的方法。 我很感激任何帮助!谢谢
【问题讨论】:
标签: electron