I've got an array in vue.js 2 with this structure:
data() {
return {
ports: [
{ id: 1, name: "example", "age": 10, scores: [ {index: 1, value: 100}, {index: 2, value: 200} ]},
{ id: 2, name: "example", "age": 10, scores: [ {index: 1, value: 100}, {index: 2, value: 200} ]}
{ id: 3, name: "example", "age": 10, scores: [ {index: 1, value: 100}, {index: 2, value: 200} ]}
{ id: 4, name: "example", "age": 10, scores: [ {index: 1, value: 100}, {index: 2, value: 200} ]}
]
}
}
I want to replace the scores of port with id 1. I know I can replace the entire port like this:
Vue.set(this.ports, 0, newPort);
But then scores on the port object is not reactive anymore and it does not rerender in my subcomponents!
How could I accomplish this?