Skip to content

It is hoped that the emit event can still be received after the component is destroyed #8450

@zouyaoji

Description

@zouyaoji

What problem does this feature solve?

我看3.2.33版本更新日志有一条:
I see that there is an entry in the update log of version 3.2.33:

runtime-core: ensure custom events are not emitted anymore after unmount. (#5679) (71c9536), closes #5674

我希望能增加一个配置项,能让组件销毁后外面也能够正常接收到emit的事件。
I hope to add a configuration item, so that the outside can normally receive the emit event after the component is destroyed.

因为有些场景可能还是需要这样,比如我基于了vue组件的生命周期写了一个地图组件,在组件创建时初始化了地图实例viewer,在组件销毁的时候去销毁了这个地图实例viewer。等viewe销毁后再emit的事件,外部都接收不了。

Because some scenarios may still need this, for example, I wrote a map component based on the life cycle of the Vue component, initialized the map instance viewer when the component was created, and destroyed the map instance viewer when the component was destroyed. The event that emits after the viewe is destroyed cannot be received by the outside world.

What does the proposed API look like?

non

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