Getting Form Context in Components
When FormCreate generates custom components, it automatically injects some useful parameters into the component. You can access them through props.formCreateInject.
Property Description
| Property Name | Type | Description |
|---|---|---|
| api | Object | Form API instance |
| form | Function | Form creation function |
| slots | Function | Get form slots |
| options | Array | rule.options configuration options |
| children | Array | Child element array |
| preview | boolean | Preview mode flag |
| id | string/Number | Unique identifier |
| input | boolean | Whether it is a form component |
| field | string | Form field name |
| rule | Object | Form rule configuration |
| t | Function | Multi-language translation function |
Getting Context
In custom components, get form context information through the formCreateInject property, enabling components to access the form's API instance, data state, etc., achieving deep integration and interaction with the form.
vue
<script>
export default defineComponent({
props: {
formCreateInject: Object
}
})
</script>Using in Setup
vue
<script setup>
const props = defineProps({formCreateInject: Object});
</script>By mastering the generation and operation methods of custom components above, you can implement almost any complex form requirements in FormCreate. Whether it's a simple button or complex dynamic form items.


