vue项目如何修改title旁边的icon图片
vue修改title旁边的icon图片
找到 public 文件夹下,修改 index.html 页面
<link rel="icon" type="image/x-icon" href="static/logo.png" rel="external nofollow" >
将你要修改的 logo 图片放在 static 文件夹下(浏览器这里并不认识 src 文件夹),所以放在 statis 文件夹下才能正确找到图片做替换操作。
修改vue项目的title左边的logo
1、icon命名为favicon.ico放在项目根目录;
2、在index.html中写入:
<link rel="icon" href="./favicon.ico" type="image/x-icon">
3、修改build下面webpack.prod.conf.js和webpack.dev.conf.js:
修改:添加一行favicon: path.resolve('favicon.ico'), // 引入图片地址
webpack.prod.conf.js:
new HtmlWebpackPlugin({ filename: process.env.NODE_ENV === 'testing' ? 'index.html' : config.build.index, template: 'index.html', favicon: path.resolve('favicon.ico'), // 引入图片地址 inject: true, minify: { removeComments: true, collapseWhitespace: true, removeAttributeQuotes: true // more options: // https://github.com/kangax/html-minifier#options-quick-reference }, // necessary to consistently work with multiple chunks via CommonsChunkPlugin chunksSortMode: 'dependency' }),
webpack.dev.conf.js:(看一下这个文件上面有没有const path = require('path'))
new HtmlWebpackPlugin({ filename: 'index.html', template: 'index.html', inject: true, favicon: path.resolve('favicon.ico'), // 引入图片地址 }),
4、重新运行,重新打包
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
Vue-router不允许导航到当前位置(/path)错误原因以及修复方式
本文主要介绍了Vue-router不允许导航到当前位置(/path)错误原因以及修复方式,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2021-09-09Vue插件报错:Vue.js is detected on this page.问题解决
这篇文章主要介绍了Vue插件报错:Vue.js is detected on this page.问题解决,本篇文章通过简要的案例,讲解了该项技术的了解与使用,以下就是详细内容,需要的朋友可以参考下2021-07-07解决antd 表单设置默认值initialValue后验证失效的问题
这篇文章主要介绍了解决antd 表单设置默认值initialValue后验证失效的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2020-11-11
最新评论