login blocking on the official website is to jump to a fixed page, such as
//
router.beforeEach((to, from, next) => {
if (to.matched.some(res => res.meta.requireAuth)) { //
if (judgingLogon()) { //
next()
} else { //
next({
path: "/login",
query: { back: to.query }
})
}
} else {
next()
}
})
this allows you to jump to the corresponding login page when you need to log in, but now the login box pops up when you click on a navigation that needs to be logged in, and the login box component has been written. The question is: how to control the data of this login component in beforeEach? That is, a login box pops up on all the pages that need to be logged in, and the login box can be triggered when the user clicks the [login] button.