-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.js
More file actions
59 lines (52 loc) · 1.19 KB
/
main.js
File metadata and controls
59 lines (52 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const { app, BrowserWindow, screen, Menu } = require('electron')
function createWindow() {
const { width, height } = screen.getPrimaryDisplay().workAreaSize
const win = new BrowserWindow({
width: Math.round(width * 0.8), // 设置宽度为屏幕宽度的80%
height: Math.round(height * 0.8), // 设置高度为屏幕高度的80%
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
autoHideMenuBar: true // 隐藏菜单栏
})
win.loadURL('https://ai.woftsun.cn')
}
const template = [
{
label: '菜单',
submenu: [
{
label: '菜单1',
click: () => {
console.log('加想要的逻辑')
// 在这里添加你的代码
}
},
{
label: '菜单2',
click: () => {
console.log('加想要的逻辑')
// 在这里添加你的代码
}
}
]
},
{
label: '关于',
submenu: [
{
label: 'Undo',
role: 'undo'
},
{
label: 'Redo',
role: 'redo'
}
]
}
]
app.whenReady().then(createWindow)
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})