Vue-element-admin: 标签栏右键刷新后地址栏的redirect没有消失,控制台报错

Created on 8 May 2019  ·  7Comments  ·  Source: PanJiaChen/vue-element-admin

Bug report:标签栏右键刷新后地址栏的redirect没有消失,控制台发出警告与错误信息。

但是线上没有这个问题,本地会出现。并且项目从3.8.x版本拉下来,去掉了原有的权限控制,改成了从后台获取菜单,其余没变化。
[vue-router] uncaught error during route navigation:

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at processState (backend.js:2108)
    at getInstanceState (backend.js:1958)
    at getCustomInstanceDetails (backend.js:1971)
    at backend.js:298
    at EncodeCache.cache (backend.js:234)
    at Object.replacer (backend.js:298)
    at encode (backend.js:2456)
    at encode (backend.js:2457)
    at encode (backend.js:2466)

Steps to reproduce(问题复现步骤)

右键标签,点击刷新

Screenshot or Gif(截图或动态图)

_20190508184408
_20190508184445
_20190508185042

Link to minimal reproduction(最小可在线还原demo)

无法提供

Other relevant information(格外信息)

  • Your OS: Win10 Chrome 74.0.3729.131 (正式版本) (64 位) (cohort: Stable)
  • Node.js version: v10.2.0
  • vue-element-admin version: 3.8.x
not vue-element-admin bug

Most helpful comment

这个报错是因为devtools插件引起的。src/views/redirect/index.vue使用了beforeCreate钩子,还未初始化data就被跳转。导致devtools在获取data的时候为undefined。
解决办法:
方法一:关闭devtools
方法二:将beforeCreate换成created钩子
@PanJiaChen @TY-LIU

All 7 comments

我侧栏与标签栏的代码与最新版本的代码一致,唯一不同的地方可能就是权限那里,但是是能正常加载路由的。我仔细看了跳转的方式,实在是不知道问题到底出在哪里

这个报错是因为devtools插件引起的。src/views/redirect/index.vue使用了beforeCreate钩子,还未初始化data就被跳转。导致devtools在获取data的时候为undefined。
解决办法:
方法一:关闭devtools
方法二:将beforeCreate换成created钩子
@PanJiaChen @TY-LIU

@OpenSourceLearners 哇老哥你是怎么发现这么隐蔽的bug的,我一直以为是我权限那块出了问题,想不到居然是devtools的锅。我就说怎么生产环境没有这个问题,十分感谢,这bug终于得到了解决

我遇到这个问题找了好久才找到。
我也是发现生产环境没有这个问题,生产环境没有使用devtools

------------------ 原始邮件 ------------------
发件人: "Shilan"notifications@github.com;
发送时间: 2019年5月11日(星期六) 下午2:28
收件人: "PanJiaChen/vue-element-admin"vue-element-admin@noreply.github.com;
抄送: "阿晓"2389640655@qq.com; "Mention"mention@noreply.github.com;
主题: Re: [PanJiaChen/vue-element-admin] 标签栏右键刷新后地址栏的redirect没有消失,控制台报错 (#2032)

@OpenSourceLearners 哇老哥你是怎么发现这么隐蔽的bug的,我一直以为是我权限那块出了问题,想不到居然是devtools的锅。我就说怎么生产环境没有这个问题,十分感谢,这bug终于得到了解决


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

我最近也遇到这个问题,今天才解决的。

为何我的还是不能跳转?

Was this page helpful?
0 / 5 - 0 ratings