如何删除Vue中的硬编码图标?

问题描述 投票:0回答:1

我安装了Vue CLI 3和PWA插件以及i18n。

我删除了/ public /中的所有Vue图标文件(包括/ public / img / icons中的PNG),删除了/ src / assets中的logo.png文件,删除了/ public / index中的链接(rel = icon)标记.html,更改了manifest.json以删除对现有Vue图标文件的任何引用,清除了我的浏览器缓存,但在加载页面时,我仍然在我的DOM中获取这些硬编码链接标记:

<link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png">
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png">
<link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87">
<meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png">

这些文件都不存在,并且在我的项目中的任何位置都没有引用它们。最奇怪的是,默认的Vue favicon仍在我使用的任何浏览器中显示,即使在删除所有文件之后,所以它绝对不是客户端缓存的东西。

我怎样才能删除这些?

vue.js webpack vuejs2 webpack-dev-server vue-cli-3
1个回答
2
投票

我只是想通知我需要编辑我的vue.config.js并添加如下内容:

    pwa: {
        name: 'Test',
        iconPaths: {
          favicon32: '(any icon file here)',
          favicon16: '(any icon file here)',
          appleTouchIcon: '(any icon file here)',
          maskIcon: '(any icon file here)',
          msTileImage: '(any icon file here)'
        }
    }

覆盖默认设置(请参阅https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa

© www.soinside.com 2019 - 2024. All rights reserved.