1 router.beforeEach((to, from, next) => { 2 const auth = router.app.$options.store.state.auth 3 4 if ( 5 (auth && to.path.indexOf('/auth/') !== -1) || 6 (!auth && to.meta.auth) 7 ) { 8 next('/') 9 } else { 10 next() 11 } 12 })
跳转到首页