设置Vue单页面标题

1、找到路由 页面设置标题

//router/index.js

{
    path: '/Userlist',
    name: 'Userlist',
    component: Userlist,
    meta: {
        title: '员工列表'
    }
},

 

 

watch:{
    // 获取路由的相关数据参数
    $route(){
      console.log(this.$route.meta);
      // 设置单页面 的 标题 内容
      document.title = '海尔后台管理系统' +'---'+ this.$route.meta.title;
    }
  },
  created(){
    this.selectedKeys = [this.$route.path];//获取当前页面的路由参数信息,并设置选中状态
    console.log('this.$rounte',this.$route);
  },

 

 

posted @ 2021-11-02 00:05  行者_Panda  阅读(156)  评论(0)    收藏  举报