I have a computed property which is---
computed: {
getGrouped() {
let ColorwithRate = [];
this.FilteredColor.forEach((c, index) => {
c.selectedRate = 0;
console.log(this.getGrouped[index])
console.log(this.getGrouped[index].selectedColor)
ColorwithRate.push(c);
})
return ColorwithRate;
}
},
the console.log(this.getGrouped[index]) shows an array in console.which is---
But console.log(this.getGrouped[index].selectedColor , it shows --
Cannot read properties of undefined (reading 'selectedColor')
this.getGrouped[index]is returning an array. Then you have to iterate it to access the properties of an object. Try this :this.getGrouped[index].forEach(obj => { console.log(obj.selectedRate) })