I want to pass the arrays in another component and assigned it to a variable
MainList.vue
<map-view
:model="addressCoordinates">
</map-view>
//vue js code
this.addresses.forEach(a => {
Vue.$geocoder.setDefaultMode('address'); // this is default
var addressObj = {
address_line_1: a.address_line_1,
address_line_2: a.address_line_2,
city: a.city,
country: a.country.name
}
Vue.$geocoder.send(addressObj, response => {
this.addressCoordinates = response.results[0].geometry.location
console.log(this.addressCoordinates)
});
})
My question is how can I assign it in a variable in MapView.vue
export default {
name: 'MapView',
props: {
model: {},
},
data() {
return {
coordinates: {}, //I want to pass the the model arrays data here
}
In order for me to loop those data here
<gmap-marker v-for="(item, key) in coordinates"/> <!-- Coordinates are from models data in Main.vue-->
I had a hard time to explain because this problem is a little bit complicated to me.