错误代码:
router.beforeEach(async (to, from, next) => { NProgress.start() const token = store.getters.token; debugger if (whiteList.indexOf(to.path) !== -1) { next() } else { ... } else { next(`/login?redirect=${to.path}`) NProgress.done() } } });
原因分析:多加了一个async,去掉即可。