Searching for the optimal method to handle looping components has been my current focus. Below is an example of my coding dilemma.
What I am attempting to accomplish is having payments data in my main component loop into child components.
<tr v-for="payment in payments"
is="component-payment-item"
:payment="payment
v-on:toggleReported="togglePaymentReported"">
</tr>
Whenever a child component needs to mark a payment as reported, it sends an event back up to the parent component. To tackle this issue, I coded the following solution:
togglePaymentReported(payment) {
payment.reported = ! payment.reported;
}
Although the function executes properly, the changes do not reflect in the child component. I have considered directly modifying the payment within the array, assuming it would be passed by reference and updated in the child component as well.
In vue 1.0, adjusting the child component itself was feasible but not recommended and no longer supported in vue 2.0. What approach should I adopt in this scenario?