You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/form/index.en-US.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,12 +116,14 @@ The first is to use multiple `a-form-item`:
116
116
</a-form-item>
117
117
```
118
118
119
-
The second way is to wrap it with a custom component and call `useFormItemContext` in the custom component
119
+
The second way is to wrap it with a custom component and call `useFormItemContext` in the custom component, It is equivalent to merging multiple form items into one.
120
120
121
121
```html
122
122
<script>
123
+
// custom component
123
124
import { Form } from'ant-desing-vue';
124
125
exportdefault {
126
+
name:'custom-name',
125
127
setup() {
126
128
constformItemContext=Form.useFormItemContext();
127
129
},
@@ -138,6 +140,15 @@ The second way is to wrap it with a custom component and call `useFormItemContex
138
140
</a-form-item>
139
141
```
140
142
143
+
Third, the component library provides an `a-form-item-rest` component, which will prevent data collection. You can put form items that do not need to be collected and verified into this component. It is the same as the first This method is very similar, but it does not generate additional dom nodes.
Form.Item hijacks the only child element and listens to the `blur` and `change` events to achieve the purpose of automatic verification, so please make sure that the form field is not wrapped by other elements. If there are multiple child elements, only the change of the first child element will be monitored.
0 commit comments