// 全局前置路由守卫——初始化的时候被调用,每次路由切换之前被调用
router.beforeEach((to, from, next)=>{// to and from are both route objects. must call `next`.if(to.meta.isAuth){if(localStorage.getItem("user")==='xiansen'){next();}else{alert("您没有权限!");}}else{next();}})// 全局后置路由守卫——初始化的时候被调用,每次路由切换之后被调用
router.afterEach((to,from)=>{// to and from are both route objects.
document.title = to.meta.title ||'测试Vue脚手架'})