Answer the question
In order to leave comments, you need to log in
How to build a form based on json metadata?
You need to create a component that will send a request to the server and receive the json structure of the future form.
How to create a component, connect and create a request to the server to get json is not a problem.
I can't figure out how to create a template out of N components based on the received data.
For example, if json contains information about what you need to show the input string Then, accordingly, you need to add a component with the input string to the template
Answer the question
In order to leave comments, you need to log in
Let the metadata be an array of objects containing two properties: the name of the component and an object with parameters:
formMeta: [
{ type: '...', props: { ... } },
{ type: '...', props: { ... } },
....
],
<div v-for="{ type, props } in formMeta" class="form-item">
<component :is="type" v-bind="props"></component>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question