Skip to content

[vue] EventBus注册在全局上时,路由切换时会重复触发事件,如何解决呢? #456

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

[vue] EventBus注册在全局上时,路由切换时会重复触发事件,如何解决呢?

Activity

xixileng

xixileng commented on Jul 1, 2019

@xixileng

在组件内的beforeRouteLeave中移除事件监听

superchangme

superchangme commented on Jul 11, 2019

@superchangme

建议在created里注册,在beforeDestory移出

Panamer

Panamer commented on Jul 25, 2019

@Panamer

在组件销毁前 $off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @haizhilin2013@superchangme@Drikold@xixileng@Panamer

        Issue actions

          [vue] EventBus注册在全局上时,路由切换时会重复触发事件,如何解决呢? · Issue #456 · haizlin/fe-interview