Describe the new feature you'd like
Pretty simple. I just need v-if support in the form schema. ie:
{
type: 'email',
label: 'Email',
vIf: myComputedBool
}
Howdy @timsayshey,
I thought a lot about conditionals during the development of the package, and it leads to a slippery slope to include it in schema format 鈥斅爏o we probably wont include conditionals in the core package, although its a good candidate for a library once hooks are implemented (#135).
However, the schema itself was intentionally designed to be reactive to address this. So the recommended path forward here would be to use something like a computed prop to produce/filter your schema, and then use that computed prop to modify the schema with any additional conditional logic. Good luck!
@timsayshey Don't put any conditions in schema, do it when rendering the schema itself. A computed prop is a great idea to push into your array only visible/available elements.
Keep in mind that the generator rest on Vue DOM generator and what I just said above is what Vue team recommends too.
Another similar subject would be to use schema values themselves to hide/show other elements/fields. I might write a plugin for that at some point.
Most helpful comment
@timsayshey Don't put any conditions in schema, do it when rendering the schema itself. A computed prop is a great idea to push into your array only visible/available elements.
Keep in mind that the generator rest on Vue DOM generator and what I just said above is what Vue team recommends too.
Another similar subject would be to use schema values themselves to hide/show other elements/fields. I might write a plugin for that at some point.