修复在开发模式下没有正确加载托盘图标的问题
This commit is contained in:
parent
24cb194937
commit
66c3d6f948
@ -5,7 +5,7 @@
|
||||
"description": "My Electron application description",
|
||||
"main": ".vite/build/main.js",
|
||||
"scripts": {
|
||||
"start": "electron-forge start",
|
||||
"start": "cross-env NODE_ENV=development electron-forge start",
|
||||
"package": "electron-forge package",
|
||||
"make": "electron-forge make",
|
||||
"publish": "electron-forge publish",
|
||||
@ -30,6 +30,7 @@
|
||||
"@types/electron-squirrel-startup": "^1.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "36.0.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
|
@ -174,7 +174,7 @@ const createWindow = () => {
|
||||
{ label: '显示窗口', click: () => win.show() },
|
||||
{ label: '退出程序', click: () => app.exit() }
|
||||
]);
|
||||
const iconPath = path.join(process.resourcesPath, 'assets', 'tray.png');
|
||||
const iconPath = process.env.NODE_ENV === 'development' ? path.join(__dirname, '../../assets/tray.png') : path.join(process.resourcesPath, 'assets', 'tray.png');
|
||||
const tray = new Tray(iconPath);
|
||||
tray.setToolTip('中国电信-工作台');
|
||||
tray.setContextMenu(contextMenu);
|
||||
|
Loading…
x
Reference in New Issue
Block a user