Skip to content

Cookbook - [14] - Practical use of scoped slots with GoogleMaps - follow-up #1848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/v2/cookbook/practical-use-of-scoped-slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Let’s first establish our `GoogleMapLoader.vue` template:
Now, our script needs to pass some props to the component which allows us to set the [Google Maps API](https://developers.google.com/maps/documentation/javascript/reference/) and [Map object](https://developers.google.com/maps/documentation/javascript/reference/map#Map):

```js
import GoogleMapsApiLoader from "google-maps-api-loader"
import GoogleMapsApiLoader from 'google-maps-api-loader'

export default {
props: {
Expand All @@ -61,7 +61,7 @@ export default {

methods: {
initializeMap() {
const mapContainer = this.$refs.googleMap)
const mapContainer = this.$refs.googleMap
this.map = new this.google.maps.Map(
mapContainer, this.mapConfig
)
Expand Down Expand Up @@ -96,7 +96,7 @@ Next up, our script needs to receive props from the parent component which will
- [apiKey](https://developers.google.com/maps/documentation/javascript/get-api-key): Our personal api key required by Google Maps

```js
import GoogleMapsApiLoader from "google-maps-api-loader"
import GoogleMapsApiLoader from 'google-maps-api-loader'

export default {
props: {
Expand Down Expand Up @@ -237,7 +237,7 @@ Now when we have our map ready we will create two factory components that will b
`GoogleMapMarker.vue`

```js
import { POINT_MARKER_ICON_CONFIG } from "@/constants/mapSettings"
import { POINT_MARKER_ICON_CONFIG } from '@/constants/mapSettings'

export default {
props: {
Expand Down Expand Up @@ -269,7 +269,7 @@ export default {
`GoogleMapLine.vue`

```js
import { LINE_PATH_CONFIG } from "@/constants/mapSettings"
import { LINE_PATH_CONFIG } from '@/constants/mapSettings'

export default {
props: {
Expand Down Expand Up @@ -340,9 +340,7 @@ Here we go, integrating the data points directly into the template:
We need to import the required factory components in our script and set the data that will be passed to the markers and lines:

```js
import {
mapSettings
} from '@/constants/mapSettings'
import { mapSettings } from '@/constants/mapSettings'

export default {
components: {
Expand All @@ -354,9 +352,9 @@ export default {
data () {
return {
markers: [
{ id: "a", position: { lat: 3, lng: 101 } },
{ id: "b", position: { lat: 5, lng: 99 } },
{ id: "c", position: { lat: 6, lng: 97 } },
{ id: 'a', position: { lat: 3, lng: 101 } },
{ id: 'b', position: { lat: 5, lng: 99 } },
{ id: 'c', position: { lat: 6, lng: 97 } },
],
lines: [
{ id: '1', path: [{ lat: 3, lng: 101 }, { lat: 5, lng: 99 }] },
Expand Down