This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
Replies: 1 comment
-
Awesome thank you for reposting it here @logaretm |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What
This is a proposal that explores a way to allows plugins to expose slot props on the
SchemaForm
componentbeforeForm
andafterForm
slots.The plugins that "add state" to formvuelate will need somehow to expose their state to the user, either via template or composition API. This is especially clear here in this issue
Now, the workaround the author suggested would work fine but they do make use of
$refs
which I'm not a fan of due to reactivity issues, although Vue 3 does offer ways to make it reactive.How
I'm suggesting implementing a
slotProps
property that can be injected in the schema that will be bound to thebeforeForm
andafterForm
slots.Here is a couple of usage examples:
This could allow us to do common things, in vee-validate's case it would open up these possibilities:
Disable buttons until all fields are valid
Display spinner or loading state when the form is submitting
Disable submit until the user makes changes to form values
Display all errors as a summary before the form fields
The downside of this approach is that if the developer wanted to access these extended properties/props inside their JS block, it will be very tricky. This might suggest adding a
useXXXXXX
function to complement this API but that's a different topic and may need its own proposal.Beta Was this translation helpful? Give feedback.
All reactions