vue項目修改favicon


首先你的在你的static文件中添加favicon.icon

然后通過以下方式進行修改

1)方式一:修改index.html文件

<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico">

這個方式可能存在的問題是,在你切換路由的時候,favicon可能又會出錯,因此建議使用方式二

2)方法二:修改webpack配置文件

build文件夾下面的 webpack.dev.conf.js,webpack.prod.conf.js,修改他們的 HtmlWebpackPlugin 配置對象

new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      inject: true,
      favicon: path.resolve(__dirname, '../static/favicon.ico')
    }),

重啟項目工程

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM