{
"name": "管理系统",
"version": "1.0.0",
"description": "管理系统",
"main": "/index.html",
"window": {
"title": "ERP",
"icon": "./img/ERP_256.png",
"toolbar": true,
"frame": true,
"position": "center",
"width": 1920,
"height": 1080,
"show_in_taskbar": true
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dist": "build --tasks win-x86,win-x64 --mirror https://npm.taobao.org/mirrors/nwjs/ .",
"start": "run --x86 --mirror https://npm.taobao.org/mirrors/nwjs/ ."
},
"author": "",
"license": "ISC",
"devDependencies": {
"nwjs-builder-phoenix": "^1.15.0"
},
"build": {
"nwVersion": "0.27.5"
}
}
打开应用之后里面的图标显示成功了,但是任务栏图标没有修改成功
如果你按照教程正确完成了修改桌面任务栏图标的操作,但是发现修改的图标没有生效,可能有以下原因:
浏览器缓存:浏览器有可能将旧版图标缓存起来,导致修改后不生效。可以尝试清除浏览器缓存,或使用不同的浏览器进行测试。
Icon 路径错误:在 nw.js 中,图标应该在 package.json 文件中指定,例如:
{
"name": "My App",
"main": "index.html",
"version": "0.1.0",
"description": "My cool app",
"keywords": ["cool", "app"],
"author": "Me",
"chromium-args": "--disable-features=RendererCodeIntegrity --no-proxy-server --disable-web-security",
"window": {
"title": "My App",
"icon": "assets/icon.png",
"width": 800,
"height": 600
}
}
其中,icon 字段指定了图标的路径。如果路径错误或图片文件不存在,将无法显示修改后的图标。
操作系统限制:有些操作系统可能会对桌面任务栏图标进行限制,以确保应用程序图标不被误认为是系统图标。如果使用的是 Windows 操作系统,则需要使用专门的图标格式(.ico),并且通常需要在任务栏中卸载旧版应用程序并重新运行应用程序。