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()
})

猜你喜欢

转载自www.cnblogs.com/llqwm/p/9152082.html