Skip to content

在beforeEach中使用next(path)后,手动改变url中的hash或点击<a href="#/p1">这种形式的链接无法跳转 #856

Closed
@x531tanxl

Description

@x531tanxl

重现url:https://jsfiddle.net/3ja5Lvb9/Lmf9yy0u/2/ ,点击 p1-hash 不生效,但url上的hash已经改变了。

通过调试源代码发现没有绑定hashchange事件。

vue版本:2.0.3,vue-router版本:2.0.1。


这种情况下这里绑定事件的回调未执行:

this.transitionTo(getHash(), function () {
  window.addEventListener('hashchange', function () {
    this$1.onHashChange()
  })
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions