在vuejs router文档中,
router.beforeEach((to, from, next) => { if (to.matched.some(record => record.meta.requiresAuth)) {
if (!auth.loggedIn()) { next({ path: '/login', query: { redirect: to.fullPath }
})
} else { next()
}
} else { next()
}
})
这段代码中的auth.loggedIn()这个方法应该写在那里?
还有就是这个query字段有什么用,没有也是可以的啊?
小怪兽爱吃肉
智慧大石
随时随地看视频慕课网APP
相关分类