IOR*_*R88 2 javascript node.js electron
1.Step
mainWindow = new BrowserWindow({
width: 1200,
height: 700,
center: true,
'min-height': 700,
'min-width': 1200,
webPreferences: {nodeIntegration:true}});
mainWindow.loadURL(HOME_URL);
Run Code Online (Sandbox Code Playgroud)
2.Step(某些事件发生,我想临时隐藏主窗口并显示另一个(createFacebookWindow()fn已经在loadingURL))
mainWindow.hide();
facebookWindow = require('./modules/auth/views.js').createFacebookWindow();
FB Window settings ({
width: 1200,
height: 700,
center: true,
'min-height': 700,
'min-width': 1200,
webPreferences: {nodeIntegration:false}})
Run Code Online (Sandbox Code Playgroud)
3.Step(另一个事件发生我破坏fb窗口并显示主窗口)
facebookWindow.close();
facebookWindow.on('closed', function() {
facebookWindow = null;
mainWindow.show();
//I tried below options it doesn't work
//mainWindow.setSize(1200, 700);
//mainWindow.setMinimumSize(1200, 700);
Run Code Online (Sandbox Code Playgroud)
摘要:
所以实际上在这些步骤之后,当我显示mainWindow时,它不记得mainWindow设置min-height和min-width不起作用.
当facebookWindow没有打开时,一切都很好,所以在用Windows切换时必须发生一些事情.也许某些事情的顺序错误?
小智 8
你可以在BrowserWindow这里阅读文档:https://github.com/electron/electron/blob/master/docs/api/browser-window.md
maxWidth 代替 max-widthminWidth 代替 min-width
maxHeight 代替 max-height
minHeight 代替 min-height