我已经构建了 Electron 应用程序,现在想使用提到的 Tray 功能 here
我给出的图标路径位于基本位置的构建文件夹中,如下所示
tray = new Tray(`file://${__dirname}/build/icon.ico`);
我想知道如何使用文档中未提及的图标。
最佳答案
这对我有用。虽然图标的大小必须很小才能显示
const { Tray, nativeImage } = require('electron');
const iconPath = path.join(__dirname, 'build/icon-st.png');
mainWindow.tray = new Tray(nativeImage.createFromPath(iconPath));
关于javascript - Windows 10 上的 Electron 托盘图标问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48740306/