Electron如何隐藏窗体的菜单栏(Menu)?

网友投稿 3423 2022-11-17

Electron如何隐藏窗体的菜单栏(Menu)?

Electron如何隐藏窗体的菜单栏(Menu)?

const electron = require('electron')/*获取electron窗体的菜单栏*/const Menu = electron.Menu/*隐藏electron创听的菜单栏*/Menu.setApplicationMenu(null)

现在electron已经不需要通过通过remote模块来使用Menu,可以直接通过Menu模块来渲染

const { app, BrowserWindow , Menu} = require('electron'); let win; const Menus = [ { label:'Files', submenu:[ { label: 'Add File', accelerator:process.platform == 'darwin' ? 'Command+N' : 'Ctrl+N', } ] }];app.on('ready',()=>{ win = new BrowserWindow({whith:800,height:600}); win.loadFile('index.html'); win.on('closed',()=>{ win = null; }); //菜单 const mainMenu = Menu.buildFromTemplate(Menus); Menu.setApplicationMenu(mainMenu);}); app.on("window-all-closed",()=>{ if (process.platform != 'darwin') { app.quit(); }});

const { app, BrowserWindow , Menu} = require('electron');let win;const Menus = [{label:'Files',submenu:[{label: 'Add File',accelerator:process.platform == 'darwin' ? 'Command+N' : 'Ctrl+N',}]}];app.on('ready',()=>{win = new BrowserWindow({whith:800,height:600});win.loadFile('index.html');win.on('closed',()=>{win = null;});//菜单const mainMenu = Menu.buildFromTemplate(Menus);Menu.setApplicationMenu(mainMenu);});app.on("window-all-closed",()=>{if (process.platform != 'darwin') {app.quit();}});const { app, BrowserWindow , Menu} = require('electron');let win;const Menus = [{label:'Files',submenu:[{label: 'Add File',accelerator:process.platform == 'darwin' ? 'Command+N' : 'Ctrl+N',}]}];app.on('ready',()=>{win = new BrowserWindow({whith:800,height:600});win.loadFile('index.html');win.on('closed',()=>{win = null;});//菜单const mainMenu = Menu.buildFromTemplate(Menus);Menu.setApplicationMenu(mainMenu);});app.on("window-all-closed",()=>{if (process.platform != 'darwin') {app.quit();}});const { app, BrowserWindow , Menu} = require('electron');let win;const Menus = [{label:'Files',submenu:[{label: 'Add File',accelerator:process.platform == 'darwin' ? 'Command+N' : 'Ctrl+N',}]}];app.on('ready',()=>{win = new BrowserWindow({whith:800,height:600});win.loadFile('index.html');win.on('closed',()=>{win = null;});//菜单const mainMenu = Menu.buildFromTemplate(Menus);Menu.setApplicationMenu(mainMenu);});app.on("window-all-closed",()=>{if (process.platform != 'darwin') {app.quit();}});

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Docker的基本操作
下一篇:艾瑞咨询:2020年中国容器云市场研究报告
相关文章

 发表评论

暂时没有评论,来抢沙发吧~