[Vuejs]-Vue 2 – How / is it possible to create a unique layout during a v-for loop?

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>

Leave a comment