10.设置系统托盘
-- 未经授权禁止转载 --
main.js
	import { Menu, Tray } from "electron"

	//创建托盘
	const createTray = () => {
	    const icon = "resource/images/code.ico" //托盘图标
	    let template = [
	        {
	            label: '关于',
	            click: () => {
	                shell.openExternal('https://dengruicode.com') //打开外部链接
	            }
	        },
	        {
	            label: '退出',
	            click: () => {
	                app.quit()
	            }
	        }
	    ]

	    const menu = Menu.buildFromTemplate(template) //根据模板构建菜单
	    const tray = new Tray(icon)
	    tray.setContextMenu(menu) //设置菜单
	}

	//当应用准备就绪后执行
	app.whenReady().then(() => {
	    createTray() //创建托盘
	})