vue动态修改浏览器标签页名称

在mian.js添加以下代码 import router from ".router";router.beforeEach((to, from, next) > {console.log(to, from, n

 在mian.js添加以下代码

import router from "./router";

router.beforeEach((to, from, next) => {
  console.log(to, from, next);
  // 路由发生变化修改页面title 
  if (to.meta.title) {
    document.title = to.meta.title;
    next();
  }
});

 路由js文件中meta属性中加title,写标签名字

 

发布者:admin,转转请注明出处:http://www.yc00.com/web/1743814907a4511709.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信