Skip to content

V2中如何在组件外部拿到schema? #1217

Answered by janryWang
NexxLuo asked this question in Q&A [2.x]
Discussion options

You must be logged in to vote
import {Schema} from '@formily/react'

const schema = new Schema({
  type:"object"
})

<SchemaField schema={schema} />
 

这样使用,内部会基于外部传入的Schema实例来组装真正的Schema,注意需要等组件渲染完成之后才能读

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@NexxLuo
Comment options

@janryWang
Comment options

Answer selected by janryWang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants