问题描述
我是electronicjs的新手.我想将角度应用程序转换为桌面.我可以成功实现,但是问题是应用程序图标设置为默认电子,而不是我提供的图标,如下所示:
I am new to electronjs. I want to convert an angular app to desktop. I could achieve it successfully but the problem is that the app icon is set to default electron and not the icon I provided as follows:
win = new BrowserWindow({
width: 600,
height: 670,
icon: `${__dirname}/dist/assets/imgs/logo.png`
})
使用资源黑客构建应用程序后,我更改了图标,但我需要的是在构建时以正确的方式对其进行更改.我在想什么>
I changed the icon after building the app using resource hacker but what I need is to change it at build time in the correct way. what am I missing>
推荐答案
在main.js中,指定图标
In main.js, specify icon
win = new BrowserWindow({
width: 800,
height: 600,
icon: __dirname + '/Icon/Icon.icns'
})
您还可以使用辅助网址方法
You can also use helper url methods
const path = require('path')
const url = require('url')
const iconUrl = url.format({
pathname: path.join(__dirname, 'Icon/Icon.icns'),
protocol: 'file:',
slashes: true
})
检查此内容以供参考: https://medium.com/fantageek/changing-electron-app-icon-acf26906c5ad
Check this for reference: https://medium.com/fantageek/changing-electron-app-icon-acf26906c5ad
这篇关于如何更改ElectronJS App默认图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!