electron为菜单添加图标,只需要在菜单项中加一个icon属性
例子如下:
const template = [
{
label:'文件',
submenu:[
{
label:'打开',
icon:'./images/icon.png'
}
]
}
];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
{
label:'文件',
submenu:[
{
label:'打开',
icon:'./images/icon.png'
}
]
}
];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);