menu.js
1.0 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
// 这里是定义菜单的地方,详情请查看 https://electronjs.org/docs/api/menu
const { dialog } = require('electron')
const os = require('os')
const version = require('../../../package.json').version
const menu = [
{
label: '设置',
submenu: [{
label: '快速重启',
accelerator: 'F5',
role: 'reload'
}, {
label: '退出',
accelerator: 'CmdOrCtrl+F4',
role: 'close'
}]
}, {
label: '帮助',
submenu: [{
label: '切换到开发者模式',
accelerator: 'CmdOrCtrl+I',
role: 'toggledevtools'
}, {
label: '关于',
role: 'about',
click: function () {
info()
}
}]
}]
function info () {
dialog.showMessageBox({
title: '关于',
type: 'info',
message: 'electron-Vue框架',
detail: `版本信息:${version}\n引擎版本:${process.versions.v8}\n当前系统:${os.type()} ${os.arch()} ${os.release()}`,
noLink: true,
buttons: ['查看github', '确定']
})
}
export default menu