I have two arrays that I receive data from the backend. One contains city information and the other contains delivery times.
First:
cityArray: {
type: Array,
default: () => []
},
Second:
deliveryTimeArray: {
type: Array,
default: () => []
}
The data comes in a regular array format, with key-value pairs. For example,
CityArray: [{"name": "Boston"}, {"name":"Detroit"}, {""}];
and DeliveryTimeArray: [{"name": "Detroit","delivery_time: "2-7""},{"name": "Boston","delivery_time": "1-3"},{"}]
)
If the city names match, I need to display the corresponding delivery time.
I attempted the following:
<div v-for='(city, index) in deliveryTimeArray' :key='index' >
<span :class='{ "city": findDeliveryTime(city) }'> {{ city }} </span>
</div>
///////////////
findDeliveryTime(city) {
return this.cityArray.includes(city);
}
This code successfully finds matching cities, but I am unsure how to reference the delivery_time