Socket
Socket
Sign inDemoInstall

nuxt-gmaps

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-gmaps

Nuxt Google Maps Module


Version published
Weekly downloads
2.4K
increased by0.64%
Maintainers
1
Weekly downloads
 
Created
Source

🌍 Nuxt GMaps

Try it out here: Nuxt.js Google Maps Module

Buy me a coffee

ko-fi

🚀 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"
  :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>
      <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"
      }
    ]
  }
}

Keywords

FAQs

Package last updated on 27 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc