- 在router.js中设置meta属性
// 首页
{
path: "index",
component: () => import("../views/home/index/index.vue"),
meta: { title: "-首页" },
},
- 通过router的钩子beforEach修改网页名称
router.beforeEach((to, from, next) => {
document.title = "XX有限责任公司" + to.meta.title;
next();
});
最后
以上就是不安猫咪最近收集整理的关于四、Vue学习笔记——使用路由钩子动态修改网页名称的全部内容,更多相关四、Vue学习笔记——使用路由钩子动态修改网页名称内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复