桃子0

vue-cli title 里面怎动态显示文字

在路由里每个都添加一个meta
[{ path:'/login', meta: { title: '登录页面' }, component:'login' }]
 
main.js里面加如下代码:
   router.beforeEach((to, from, next) => {
      window.document.title = to.meta.title;
      next()
  });

posted on 2017-11-22 18:29  桃子0  阅读(3849)  评论(0编辑  收藏  举报

导航