1

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---

image But console.log(this.getGrouped[index].selectedColor , it shows --

Cannot read properties of undefined (reading 'selectedColor')
2
  • 1
    As you said, 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) }) Commented Nov 17, 2022 at 15:05
  • How do I put a value in selectedRate? Commented Nov 17, 2022 at 20:30

1 Answer 1

1

I believe you are using Vue3.

What does Proxy mean in the console in Vue 3?

Try console.log(toRaw(this.getGrouped.selectedColor)).

Sign up to request clarification or add additional context in comments.

2 Comments

showing undefined
toRaw is not defined --- this is showing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.