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] @formily/vue无法使用ref属性 #4199

Closed
1 task
ksh033 opened this issue Aug 7, 2024 · 2 comments
Closed
1 task

[Bug Report] @formily/vue无法使用ref属性 #4199

ksh033 opened this issue Aug 7, 2024 · 2 comments

Comments

@ksh033
Copy link

ksh033 commented Aug 7, 2024

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Vue 控件属性指定 ref,x-component-props={ref:"xxxx"}

What is expected?

$refs有xxx控件实例出现

What is actually happening?

$refs空

Package

@formily/[email protected]


是否可以在ReactiveField.ts文件支持ref属性
const componentData = {
attrs: {
disabled: !isVoidField(field)
? field.pattern === 'disabled' || field.pattern === 'readPretty'
: undefined,
readOnly: !isVoidField(field)
? field.pattern === 'readOnly'
: undefined,
...originData,
value: !isVoidField(field) ? field.value : undefined,
},
style: originData?.style,
class: originData?.class,
ref: originData?.ref,
on: events,
}
delete componentData.attrs.style
delete componentData.attrs.class

@yiyunwan
Copy link
Collaborator

现在就是支持的,可以使用 函数,或带value的对象

@ksh033
Copy link
Author

ksh033 commented Sep 4, 2024

@yiyunwan 怎么写呢?有没 json-schema 的例子。文档内没找到ref的资料。 ,我是用了 json-schema 的写法,schema组件的属性只能用 x-component-props={ref:"table"},这个属性的传参又是通过ReactiveField,ReactiveField又没传ref给组件。

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

2 participants