I loop a child components that has emitted data and pass to local data in parent but my expectation result is not what i get. It should be in incremental like this. Example
Index Total
0 5
1 7
2 10
3 12
here my code:
<template>
<div>
<div v-for="data, index in myArr">
<child-block-1
:key="index"
:data="data"
@emittedData="total += $event"
/>
<child-block-2 v-if="total > 10" />
</div>
</div>
</template>
The total data will add the emitted data, but when i check the total it will always the overall total 12. not the incremental.
Is there any other solution for this to get what my expected result ?