I currently have a dataset in the following structure:
itemlist : {
"dates": [
"2019-03-15",
"2019-04-01",
"2019-05-15"
],
"id": [
"arn21",
"3sa4a",
"wqa99"
],
"price": [
22,
10,
31
]
}
My goal is to iterate through this object using v-for within my component, where each index within the nested arrays represents one observation. So dates[0]
, id[0]
, and price[0]
correspond to the same item; dates[1], id[1], price[1] represent the second item, and so on.
Therefore, I believe I need to transform it into the following format, although I am uncertain:
0 : {
dates: "2019-03-15",
id: "arn21",
price: 22,
}
1:{
dates: "2019-04-01",
id: "3sa4a",
price: 10,
}
2:...
This is how I'm passing the data to the component:
<tempc v-for="i in itemlist" :key="i.id" :price="i.price" :dates="i.dates"></temp>
Unfortunately, this approach does not work for the original dataset.