Gmaps api5/27/2023 Now, our script needs to pass some props to the component which allows us to set the Google Maps API and Map object: import GoogleMapsApiLoader from 'google-maps-api-loader'Ĭonst googleMapApi = await GoogleMapsApiLoader( Let’s first establish our GoogleMapLoader.vue template: We will analyze the code piece-by-piece and see what is actually happening in the next section. Exposes those objects to the parent component in which the GoogleMapLoader is usedīelow is an example of how this can be achieved.We’ll create a component ( GoogleMapLoader.vue) that: Such a component could then be reused in multiple places rendering different templates but using the same base object with specific API. Imagine a component that configures and prepares an external API to be used in another component, but is not tightly coupled with any specific template. That is a typical use case for scoped slots. This is particularly useful when you need freedom in creating custom templates that use the child component’s data properties. There are situations when you want the template inside the slot to be able to access data from the child component that is responsible for rendering the slot content. Practical use of scoped slots with GoogleMaps Base Example
0 Comments
Leave a Reply. |