update AppMenu
This commit is contained in:
1 parent
87a104eff8
commit
d5dd03a6e9
2 files changed
+49
-4
No files matched your search
@@ -7,7 +7,6 @@ let createWindow = function () {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1280,
|
||||
height: 800,
|
||||
transparent: true,
|
||||
webPreferences: {
|
||||
// nodeIntegration: true
|
||||
}
|
||||
|
||||
+49
-3
@@ -2,9 +2,55 @@ import { BrowserView, Menu, app, shell, dialog, BrowserWindow, MenuItem } from '
|
||||
|
||||
export function initMenu() {
|
||||
const menu: Menu = new Menu();
|
||||
const menuItem: MenuItem = new MenuItem({
|
||||
label: "test",
|
||||
const fileMenu: MenuItem = new MenuItem({
|
||||
label: "行为树",
|
||||
submenu: [
|
||||
{ label: "打开文件" },
|
||||
{ label: "打开目录" },
|
||||
{ type: 'separator'},
|
||||
{
|
||||
label: "最近打开",
|
||||
submenu: []
|
||||
},
|
||||
{
|
||||
label: "最近目录",
|
||||
submenu: [
|
||||
{label: "master"},
|
||||
{label: "分支0908"},
|
||||
]
|
||||
},
|
||||
{ type: 'separator'},
|
||||
{
|
||||
label: "关闭",
|
||||
click: () => {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
menu.append(menuItem);
|
||||
|
||||
const toolsMenu: MenuItem = new MenuItem({
|
||||
label: "开发工具",
|
||||
submenu: [
|
||||
{
|
||||
label: "重载",
|
||||
accelerator: "ctrl + r",
|
||||
click: (_, browserWindow) => {
|
||||
browserWindow.reload();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "打开控制台",
|
||||
accelerator: "ctrl + shift + i",
|
||||
click: (_, browserWindow) => {
|
||||
browserWindow.webContents.toggleDevTools();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
menu.append(fileMenu);
|
||||
menu.append(toolsMenu);
|
||||
|
||||
Menu.setApplicationMenu(menu);
|
||||
}
|
||||
Reference in new issue
Block a user