Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] 使用 SchemaField 渲染自定义组件,models的ArrayField #4155

Closed
1 task done
alphabetabc opened this issue Jun 15, 2024 · 0 comments
Closed
1 task done

Comments

@alphabetabc
Copy link

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

我创建了一个自定义组件

export const DefineFieldAction = ()=>{

   return <SchemaField>
                <SchemaField.Array name="eventsGroup" x-component="ArrayCollapse">
                    <SchemaField.Object
                        x-component="ArrayCollapse.CollapsePanel"
                        x-component-props={{
                            header: '动作组',
                        }}
                    >
                        <SchemaField.Void x-component="ArrayCollapse.Index" />
                    </SchemaField.Object>
                    <SchemaField.Void
                        x-component="ArrayCollapse.Addition"
                        x-component-props={{
                            title: '添加动作组',
                            defaultValue: { type: 'all', events: [] },
                        }}
                    />
                </SchemaField.Array>
            </SchemaField>

}

问题描述:
ui能正常渲染,但是点击添加按钮的时候报错

image
image

What is expected?

不报错,能够正常使用

What is actually happening?

打断点发现action的this指向丢了,是undefined

Package

@formily/core@2.2.10


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant