1.main.js设置拦截器 router.beforeEach(function (to,from,next) { if (to.meta.requireAuth) { if (store.state.token) { next() } else { next({name: 'log',query: {backUrl: to.fullPath}}) } }else( next() ) }) 2.路由设置 { path: '/course',component: Course,meta: { r…