Skip to content

子组件操作/更新时 父组件 created/mounted 会再次被执行 #2581

@cnhuye

Description

@cnhuye
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.6.3

Environment

macOS Mojave, vue 2.6.11

Reproduction link

https://ozq0f.csb.app/

Steps to reproduce

示例如 reproduction link. 查看 console 中 "component created!!!" / "Hello Vue mounted" 两句,分别在 components/conponent.vue 的 created/mounted 中输出。
点击 'click' 时 created/mounted 被执行一次, 鼠标指向按钮时,又被执行第2次。

error stack 中看到是 ant-design-vue/es/_util/ContainerRender.js#62行,调用了主组件。

...
this._component = new this.$root.constructor({
...

What is expected?

自定义的组件应该不会被调用两次

What is actually happening?

created/mounted 被执行了第2次

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