Migration from ESDS 2.0/Nuxt 2
Previously, these form utilities were exposed as a mixin which you added to the mixins
of your component. Mixins are no longer recommended by Vue, and are not compatible with the composition API. Therefore, these form utilities are now provided as a composable .
To use the composable, call useEsForms
within your script, as shown in the documentation source. Parameters are your validation rules and the reactive state that includes your form. You will get back all the functions and reactive refs that were previously accessible on this
as a result of using the mixin. You will also get back the Vuelidate object, now called v$
instead of $v
due to a restriction within Vue 3.
If you're still using the options API, please refer to the Vue documentation for using a composable with the options API.
Note that while the API for functions in this composable have not changed from the version in the old mixin, there are upstream changes in Vuelidate which may require manual handling. At a minimum, $v
is now v$
as previously mentioned. Please refer to the Vuelidate Migration Guide for more information.