Is there a way to extract data from an object in Vue?
This is the format of my data:
datasets: [{
text:"Cars",
value: "[1,2,3]"
},
{
text:"Trains",
value: "[1,4,10]
}
]
When I receive information from route props like this:
this.selectedText= this.$route.name;
Where this.$route.name
might be "Cars"
, for example.
I want to use this.selectedValue
to retrieve the corresponding Value from this array:
so if this.selectedText="Cars"
, then this.selectedValue=[1,2,3]
, and so on based on the selected text.