具有固定高度和宽度的第一张图像
仅当消息太大时,我才想在单击“详细信息”按钮时设置 Electron 窗口的高度的第二张图像。我怎样才能做到这一点?
最佳答案
您可以通过渲染器进程访问BrowserWindow:
var currentWindow = require("electron").remote.getCurrentWindow();
var currentSize = currentWindow.getSize();
var animate = true;
currentWindow.setSize(currentSize[0], currentSize[1] + 100, animate);
别忘了在主进程的BrowserWindow构造函数中将 nodeIntegration 设置为true:
var messageWindow = new BrowserWindow({ webPreferences: { nodeIntegration: true } })
关于javascript - 单击按钮可增加/扩展 Electron 窗口的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58373084/