m***@foxmail.com
m***@foxmail.com
  • 发布:2020-09-16 19:23
  • 更新:2020-09-16 19:23
  • 阅读:738

#插件讨论# 【 路由、拦截、最优雅解决方案 】 注销退出到login失败

分类:uni-app

注销时调用路由跳转失效

// 状态管理代码
import router from '@/router/index.js';

......
return new Promise(resolve => {
commit("SET_TOKEN", "");
commit("SET_ROLEBTNARR", []);
commit("SET_ROLEROUTER", []);
console.log('清理干净退出!')
router.replaceAll({path: '/pages/login/login'})
resolve();
});

报错如下:

Uncaught (in promise) TypeError: Cannot set property 'query' of undefined
at formatFrom ()
at Router._callee6$ ()
at tryCatch ()
at Generator.invoke [as _invoke] ()
at Generator.prototype.(anonymous function) [as next] ()
at asyncGeneratorStep ()
at _next ()

2020-09-16 19:23 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复