I have a large number of components defined on the server. Example:
Paragraph component (can only contain text)
Quote component (may include author and quote text)
...
When a click on a given component on a web page (e.g., a quote) retrieves specific data for that component from the server, and I need to display specific fields (vue components) in the sidebar, depending on the type of component.
The problem is, moreover, that I do not know what kind of components you'll need to see before (there may be a quote request that will contain two paragraphs ...).
How do I get to dynamically display only a certain vue component and in the order that is required?
So far, I have this solution, but it is not ideal at all. If you know something better, I'll be grateful.
<template v-for="(field, index) in fields">
<my-textarea v-if ="field.type=='textarea'">...</ my-textarea>
<my-gallery v-if="field.type=='gallery'">...</ my-gallery>
</ template>