Vue Router路由守卫beforeEach的next方法使用?-灵析社区

我只爱钱

可以 router.beforeEach(async(to, from, next) => { if (to.meta.auth) { // need verification // This is a promise function 👇 await widget.user .authVerification() .then(() => { next(); }) .catch((error) => { // Session expired console.log(error); next("/login"); }); } }

阅读量:1

点赞量:0

问AI