vue:在router里面给页面加title

vue中给组件页面加页面标题:
{
path: '/',
name: 'index',
component: disconnect,
meta: { title: '首页' }
},
{
path: '/disconnect',
name: 'disconnect',
component: disconnect,
meta: { title: '没有网络' }
},


然后再main.js
router.beforeEach((to, from, next) => {
window.document.title = to.meta.title;
next()
})

转载于:https://www.cnblogs.com/llqwm/p/9152082.html

你可能感兴趣的:(vue:在router里面给页面加title)