vue 修改标题 项目头部 修改页面的title
router.js 在h5中,跳转页面会显示不同的页面标题。
const routes = [ { path: '/', component: () => import(/* webpackChunkName: "login" */ '@/views/index.vue'), meta: { hidden: true } }, { path: '/apply', component: () => import(/* webpackChunkName: "login" */ '@/views/apply.vue'), meta: { hidden: true,title:"助销员申请"} },
{
path: '/success',
component: () => import('@/views/success.vue'),
meta: { hidden: true,title:"申请提交成功" }
},
main.js
router.beforeEach((to, from, next)=>{ if(to.meta.title){ document.title = to.meta.title } next() })