0👍
✅
Within the v-for
, you can wrap the elements in a <template>
, and then just use v-if
to determine which element is displayed.
For example :
<template v-for="question in question.questions" :key="question.id">
<Input v-if="quetion.type === 'text'" :question="question" />
<Radio v-if="quetion.type === 'choice'" :question="question" />
...
</template>
Source:stackexchange.com