vue.js - 如何删除 Vue 中的硬编码图标?

标签 vue.js webpack vuejs2 webpack-dev-server vue-cli-3

我安装了带有 PWA 插件和 i18n 的 Vue CLI 3。

我删除了/public/中的所有Vue图标文件(包括/public/img/icons中的PNG),删除了/src/assets中的logo.png文件,删除了/中的link(rel=icon)标签public/index.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.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)

关于vue.js - 如何删除 Vue 中的硬编码图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55322374/

相关文章:

vue.js - 如何在嵌套数组(数组中的数组)上使用 v-for 指令进行迭代

vue.js - 来自嵌套 Axios 请求的 VueJS 数据未在 View 中呈现

google-maps - 使用 create-react-app 在 React 应用程序中未定义 google

vue.js - 不使用 npm 或 webpack 时,未应用 Vuetify 主题

javascript - Vue (nuxt) 中的全局组件

javascript - VueJS : How to pass Vue. 原型(prototype).$http 到不同的 Vue 应用程序?

javascript - Vue DevTools 正确更新但浏览器窗口不更新

javascript - 将类添加到动态更改对象列表中的顶部对象

Angular2 CLI : why bundle size of "--prod" smaller than "--prod --aot"?

javascript - 将 process.env 变量从 Node 传递或使用到 reactjs