定义路由地址:
const routes = [{
path: ‘/’,
name: ‘index’,
component: index,
//此处的meta 中的title 即为 微信的头部标签名
meta: {
title: " 活动报名"
},
},
{
path: ‘/indexApply’,
name: ‘indexApply’,
component: indexApply,
meta: {
title: " 活动报名"
},
},}]
const router = new Router({
mode: ‘hash’,
routes: routes
})
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
}
next();
})
将路由地址暴露出去
export default router;