Skip to content

aner87/nuxt-gmaps-new-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌍 Nuxt GMaps, updated APIs

This is a Fork from https://gitlab.com/broj42/nuxt-gmaps/
I simply updated the project to the latest Google Libraries, both for the map and the clusters instances.
PS: as of now clusters are no longer aesthetically customizable, any contribution to bring this feature back is appreciated.

npm version npm downloads npm downloads


Try it out here: Nuxt.js Google Maps Module

🚀 Usage

npm i nuxt-gmaps
//nuxt.config.js
modules: [
  ['nuxt-gmaps', {
    key: '<API-Key>',
    //you can use libraries: ['places']
  }]
]

📝 Updates

Documentation

Official Google Documentation

🔧 Options

  • key
  • libraries

📍️ Marker Events

  • click
  • mouseover
  • mouseout

🗺️️ Map Event

  • init
  • loaded
  • bounds_changed
  • center_changed
  • click
  • dblclick
  • drag
  • dragend
  • dragstart
  • heading_changed
  • idle
  • maptypeid_changed
  • mousemove
  • mouseout
  • mouseover
  • projection_changed
  • resize
  • rightclick
  • tilesloaded
  • tilt_changed
  • zoom_changed

Example

<GMap
  ref="gMap"
  language="en"
  :cluster="{options: {styles: clusterStyle}}"
  :center="{lat: locations[0].lat, lng: locations[0].lng}"
  :options="{fullscreenControl: false, styles: mapStyle}"
  :zoom="6"
>
  <GMapMarker
    v-for="location in locations"
    :key="location.id"
    :position="{lat: location.lat, lng: location.lng}"
    :options="{icon: location === currentLocation ? pins.selected : pins.notSelected}"
    @click="currentLocation = location"
  >
    <GMapInfoWindow :options="{maxWidth: 200}">
      <code>
        lat: {{ location.lat }},
        lng: {{ location.lng }}
      </code>
    </GMapInfoWindow>
  </GMapMarker>
  <GMapCircle :options="circleOptions"/>
</GMap>
data() {
  return {
    currentLocation: {},
    circleOptions: {
      ...
    },
    locations: [
      {
        lat: 44.933076,
        lng: 15.629058
      },
      {
        lat: 45.815,
        lng: "15.9819"
      },
      {
        lat: "45.12",
        lng: "16.21"
      }
    ],
    pins: {
      selected: "data:image/png;base64,iVBORw0KGgo...",
      notSelected: "data:image/png;base64,iVBORw0KGgo..."
    },
    mapStyle: [...],
    clusterStyle: [
      {
        url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m1.png",
        width: 56,
        height: 56,
        textColor: "#fff"
      }
    ]
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published