router/index.js

const router = new Router({
mode: 'history',
routes: [
{
path: '/index',
name: 'index',
component: Index,
meta:{
// 页面标题title
title: '首页'
}
},
{
path: '/content',
name: 'content',
component: Content,
meta:{
title: '内容'
}
}
]
})
export default router

 

main.js

router.beforeEach((to,from,next) => {
if(to.meta.title){
document.title = to.meta.title
}
});

相关文章:

  • 2022-02-06
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
相关资源
相似解决方案