首先添加一個Lorikeet版本的Electron應用。html
1 'use strict' 2 const electron = require('electron'); 3 const app = electron.app; 4 const BrowserWindow = electron.BrowserWindow; 5 6 let mainWindow = null; 7 8 app.on('window-all-closed', () => { 9 if (process.platform !== 'darwin') { 10 app.quit(); 11 } 12 }); 13 14 app.on('ready', () => { 15 mainWindow = new BrowserWindow(); 16 mainWindow.loadURL(`file://${app.getAppPath()}/index.html`); 17 mainWindow.on('closed', () => { 18 mainWindow = null; 19 }); 20 });
1 'use strict' 2 const electron = require('electron'); 3 const app = electron.app; 4 const BrowserWindow = electron.BrowserWindow; 5 const electronMenu=electron.Menu; 6 7 let mainWindow = null; 8 9 app.on('window-all-closed', () => { 10 if (process.platform !== 'darwin') { 11 app.quit(); 12 } 13 }); 14 15 app.on('ready', () => { 16 electronMenu.setApplicationMenu(null); 17 mainWindow = new BrowserWindow(); 18 mainWindow.loadURL(`file://${app.getAppPath()}/index.html`); 19 mainWindow.on('closed', () => { 20 mainWindow = null; 21 }); 22 });
1 'use strict' 2 const electron = require('electron'); 3 const app = electron.app; 4 const BrowserWindow = electron.BrowserWindow; 5 6 let mainWindow = null; 7 8 app.on('window-all-closed', () => { 9 if (process.platform !== 'darwin') { 10 app.quit(); 11 } 12 }); 13 14 app.on('ready', () => { 15 mainWindow = new BrowserWindow({autoHideMenuBar:true}); 16 mainWindow.loadURL(`file://${app.getAppPath()}/index.html`); 17 mainWindow.on('closed', () => { 18 mainWindow = null; 19 }); 20 });
另:自定義菜單設置,可參考http://www.javashuo.com/article/p-nyqajwms-bd.htmlgit
直接設置Window的屬性github
圖上:Demosegmentfault