vue 下配置标题栏 title 图标及文字的具体步骤

1,普通 HTML 页面,配置图标及文字

<head>
  <title>标题栏文字</title>
  <link rel="icon" href="../favicon.ico" type="image/x-icon">
</head>

2,vue 项目中,配置图标及文字

  • 1,在网站根目录下的 index.html 文件中 title 标签中添加标题栏文字
  • 2,将图片.ico 文件放在网站根目录下
  • 3,修改 build 文件夹下 webpack.prod.conf.js 和 webpack.dev.conf.js 文件
var path = require('path') // 开头引入 path 模块
....
// HtmlWebpackPlugin 中添加 favicon
new HtmlWebpackPlugin({
  filename: 'index.html',
  template: 'index.html',
  favicon: path.resolve('favicon.ico'), // 引入图片地址
  inject: true
})
  • 4,重新启动项目即可

猜你喜欢

转载自blog.csdn.net/M_wolf/article/details/79481885