I have a component in a v-for
<div
v-for="(plan, index) in plans"
:key="index"
>
<plan
:name="plan.name"
:cost="plan.cost"
:index="index"
ref="myPlan"
/>
</div>
Within that component I have a method which clears all the data.
clear() {
this.cost = '';
// some more clearing code
},
I am trying to clear the plan by calling this method.
this.$refs.myPlan.clear();
This does not work because the ref is an array, but this does clear the first plans
this.$refs.myPlan[0].clear();
How can I call the clear method on all of the plans?