Skip to content

Wrapped by form-item in the component, if it has a slot, it will be rendered twice #5134

@yuexing91

Description

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

Version

3.0.0-beta.5

Environment

"vue": "3.2.23" "ant-design-vue": "^3.0.0-beta.5" Microsoft Edge 96.0.1054.62

Reproduction link

Edit on CodeSandbox

Steps to reproduce

import { h, createApp } from "vue";
import { Form } from "ant-design-vue";

let count = 0;

const Comp = () => {
return count;
};

const App = () => {
return h(Form, h(Form.Item, h(Comp, "渲染次数"))); // count = 2
// return h(Form, h(Form.Item, h(Comp))); // 如果Comp组件没有插槽 count = 1
};

createApp(App).mount("#app");

What is expected?

页面结果应该是1

What is actually happening?

被form-item包裹在组件,如果拥有插槽将被渲染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