- index.html中一般设置了
<title><%= htmlWebpackPlugin.options.title %></title>
- 不同的Vue页面中,mounted(){}函数中增加标题设置
mounted(){
document.title = "自定义标题";
}
文章讲述了在Vue应用中,如何在不同页面通过`mounted()`生命周期钩子动态设置`document.title`来实现自定义标题。同时,介绍了在`index.html`中利用`HTMLWebpackPlugin`的选项来设置全局的基础标题。
<title><%= htmlWebpackPlugin.options.title %></title>
mounted(){
document.title = "自定义标题";
}
1万+
737
5209
7775
1099

被折叠的 条评论
为什么被折叠?
