vue.js添加favicon图标的方法:1、修改【index.html】文件,代码为【<link rel="shortcut icon" type="image/x-icon" href="favico】;2、修改webpack配置文件。
宿豫网站建设公司成都创新互联公司,宿豫网站设计制作,有大型网站制作公司丰富经验。已为宿豫数千家提供企业网站建设服务。企业网站搭建\外贸网站制作要多少钱,请找那个售后服务好的宿豫做网站的公司定做!
【相关文章推荐:vue.js】
vue.js添加favicon图标的方法:
方法一:修改index.html文件
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
缺点:打包后需要将favicon.ico
复制到根目录
方法二:修改webpack配置文件
1、找到build下的webpack.dev.conf.js文件
new HtmlWebpackPlugin({ filename: 'index.html', template: 'index.html', inject: true, favicon: path.resolve('favicon.ico') // 新增 }),
2、找到build下的webpack.prod.conf.js文件
new HtmlWebpackPlugin({ filename: config.build.index, template: 'index.html', inject: true, favicon: path.resolve('favicon.ico'), //新增 minify: { emoveComments: true, collapseWhitespace: true, removeAttributeQuotes: true ... }),
方法三 :vue项目打包后favicon无法正常显示
解决方法:
在webpack.prod.config.js中的HtmlWebpackPlugin插件选项中配置favicon选项,其中favicon的路径是个相对路径
new HtmlWebpackPlugin({ filename: 'index.html', template: 'index.html', favicon: 'src/assets/img/favicon.ico', inject: true }),
修改配置文件后需重启npm run dev
打包后根目录下就会有favicon.ico
相关免费学习推荐:JavaScript(视频)
本文标题:vue.js中怎么添加favicon图标
转载来于:https://www.cdcxhl.com/article26/cpcjcg.html
成都网站建设公司_创新互联,为您提供自适应网站、小程序开发、Google、商城网站、App开发、网站收录
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联