vue 下配置標題欄 title 圖示及文字的具體步驟
阿新 • • 發佈:2019-01-22
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,重新啟動專案即可