以vue2项目为例
修改网站标题
找到 vue.config.js
module.exports = defineConfig({
chainWebpack: (config) => {
config.plugin("html").tap((args) => {
args[0].title = "xxxx";
return args;
});
},
})
修改网站logo
public / index.html 这个就是你所在网站资源的logo图标
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
内容无需修改
**<link rel="icon" href="<%= BASE_URL %>favicon.ico">**
favicon.ico就是你网站的logo 要想换掉只需要把你需要的logo替换掉并且命名为favicon.ico 如下图