[Vuejs]-$emit from child to parent, Simple increment counter causes infinite loop

0👍

Answer was actually fairly simple.

On the parent component I added .once on the event and this stopped the loop and allowed it to increment as expected.

<template>
     <div class="interactive interactive-vue-question interactive-vue-question-iv">
     <component 
       :is="buildQuestion(index)"
        ref="ivWrap"
        v-for="(item, index) in questionParts"
        :key="index"
        :questionProps="item.includes('*_*') ? matchedOptions[index] : item"
         @success.once="questionSuccess">
     </component>
   </div>
</template>

Leave a comment