导航守卫:也叫路由守卫 业务需求:动态改变页面title 1:在组件mount中 使用document.title = ‘标题名’ 2.使用前置钩子:beforeEach 它有三个参数(to,from,next) mate是元数据
const router = {
path: '/apply',
name: 'apply',
component: apply,
meta: {
title: '申请'
}
}
$riuter.debofrEach((to,from,next) =>{
document.title = to.meta.title
})