且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何更新渐进式Web应用程序的主屏幕图标?

更新时间:2021-07-30 09:14:15

听起来像上面的评论中您得到了答案,我只是想提出一些对我有所帮助的东西.我的应用程序位于React而不是Angular中(我是一个菜鸟,所以我不知道这是否重要,但是我想做个记录以防万一)并且当我尝试将应用程序图标放在src中时(我的是在像您这样的"/资产"中),它并没有刷新图标.为了清楚起见,我只尝试了一次-但是DevTools中的application标签也没有看到我的图标.因此,我将图标放在图像文件夹中的公用文件夹中,当我重新安装该应用程序时,它的图标非常完美.我已经有了该文件夹来存放我的标签图标(忘记了该术语的技术术语),所以我不觉得自己在添加任何会使我的应用程序anything肿的东西,但这是我的看法.

Sounds like in the comments above you got your answer, I just wanted to throw up something that helped me. My app is in React not Angular (and I'm a noob so I don't know if that would matter but I wanted to make note in case it did) and when I tried to have the app icon within the src (mine is in "/assets" like yours) it wasn't updating the icon with a refresh. To be very clear here, I only tried once - but the application tab in DevTools wasn't seeing my icon either. So instead I put the icon in my public folder within an images folder and when I reinstalled the app it had my icon perfect. I already had that folder to house my tab icon (forgot the technical term for that) so I didn't feel like I was adding anything that was bloating my app but that's my opinion.

不知道这是否有帮助,我没有走过这个兔子洞,试图弄清楚为什么我没有在src/assets中捕获图像.

Don't know if that helps, I didn't go down this rabbit hole trying to figure out why mine wasn't catching the image in the src/assets.