Within a v-for loop, I have a method called in a child div.
<div v-for="(item,index) in timesheetRequests">
<h6 class="card-title mt-3" :id="'req_'+index" v-if="yearMonthInsertion(item,index)">Something</h6>
.
.
.
</div>
This is how the method is defined:
yearMonthInsertion:function(item,index){
var meta = item["meta"]
var last_updated_on = meta['last_updated_on']
last_updated_on = last_updated_on.replaceAll("-","/")
var requestUpdateDate = moment(last_updated_on,"YYYY/MM/DD")
var month = requestUpdateDate.format("MMMM")
var day = requestUpdateDate.format('D');
var year = requestUpdateDate.format('YYYY');
console.log("HERE...ll")
var obj = {}
obj["month"] = month
obj["status"] = true
this.date_element.push(obj)
console.log("THIS....")
console.log(this)
}
https://i.sstatic.net/fg8Ct.png
Removing this line from the code fixes the error. The goal is to add items to the array during the v-for loop execution:
this.date_element.push(index)
Thank you for your help!