mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
docs(migration): update form validation error property name (#4557)
This commit is contained in:
@@ -536,6 +536,33 @@ import { ModalExampleComponent } from '#components'
|
||||
</script>
|
||||
```
|
||||
|
||||
### Changed form validation
|
||||
|
||||
- The error object property for targeting form fields has been renamed from `path` to `name`:
|
||||
|
||||
```diff
|
||||
<script setup lang="ts">
|
||||
const validate = (state: any): FormError[] => {
|
||||
const errors = []
|
||||
if (!state.email) {
|
||||
errors.push({
|
||||
- path: 'email',
|
||||
+ name: 'email',
|
||||
message: 'Required'
|
||||
})
|
||||
}
|
||||
if (!state.password) {
|
||||
errors.push({
|
||||
- path: 'password',
|
||||
+ name: 'password',
|
||||
message: 'Required'
|
||||
})
|
||||
}
|
||||
return errors
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
::warning
|
||||
|
||||
Reference in New Issue
Block a user