在 vue.config.js 中通过如下配置设置页面标题:
chainWebpack: (config) => {
config
.plugin('html')
.tap((args) => {
args[0].title = 'Custom Title';
return args;
});
}
然后在 html 页面中使用 <%= htmlWebpackPlugin.options.title %> 引用该配置。
module.exports={
devServer:{
open:true
},
chainWebpack: (config) => {
config
.plugin('html')
.tap((args) => {
args[0].title = '你的应用的名字';
return args;
});
}
}