[Vuejs]-Pushing object in an array results to infinite loop

0👍

v-if is not the right place to execute this code, because you don’t know when and how many times the function will be called. You push into date_element, but you never clear it so the array length will only grow.

You should probably define this.date_element as a computed property, so it would always be up to date.

Leave a comment