gpt4 book ai didi

vue.js - Vue index.html 图标问题

转载 作者:搜寻专家 更新时间:2023-10-30 22:15:18 25 4
gpt4 key购买 nike

我正在使用 Vue 2.0 和 Vue CLI 3.0。我正在尝试让 favicon.ico/png 文件正常工作,但一点运气都没有。

我已将问题缩小为以下内容。

yarn build生成的index.html文件将这行html代码转换为:

<link rel="icon" href="favicon.png" >

为了...

<!--[if IE]><link rel="icon" href="favicon.png"><![endif]-->

如果我进入 Chrome 开发者工具并将该行改回原来的方式,ico/png 文件会按预期呈现。

我的问题是:我该如何解决这个问题,这样 yarn build 就不会弄乱我的 html 代码。

最佳答案

vue.config.js 中设置图标的 PWA 选项以指向您想要的任何图标。具体来说,设置pwa.iconPaths例如:

module.exports = {
pwa: {
iconPaths: {
favicon32: 'img/icons/myFavicon.png',
}
}
}

关于vue.js - Vue index.html 图标问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52684709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com