I have a child component and it has one field which pulls in repeating data from an Axios request.
Displays Name: blue, blue, red, orange, green, green, blue
Child
<div v-if="color">
<strong> Color:</strong> {{ color }}
</div>
data: function () {
return {
color: this.result.color
}
Parent
<Result
v-for="(result, index) in Results"
:result="result"
/>
JSON
"result": [
"results": {
"color": "Blue, Green, Red",
},
"results": {
"color": "Blue",
},
"results": {
"color": "Red",
},
"results": {
"color": "Green, Red",
},
.....
How can I remove the duplicates? I have tried using a method/computed but I could get it to work. I tried a computed prop on the parent and passing it but it messed up other results on the parent. Would a mutation be better? I want to do this on the child component and not on the parent if possible.
Any help appreciated.