vue-googlemaps
Integrate Google Maps in your Vue application in a "Vue-way".
This library is Work In Progress. More components will be available in the 1.0 release.
The main objective of the library is to use Google Maps using Vue components in a way that feels natural to Vue developpers (with props, events, slots...).
Sponsors
Silver
Bronze
Table of Contents
Installation
npm i -S vue-googlemaps
yarn add vue-googlemaps
You need to polyfill some ES2015 features in old browsers.
Usage
You need a Google API key from the developer console.
Vue
Builtin components
(Documentation is work-in-progress)
- Circle
- Geocoder
- Map
- Marker
- NearbyPlaces
- PlaceDetails
- UserPosition
- More to come!
Create you own components
Here is an example of what a Marker
component would look like:
// Those Vue props will update automatically// (Two-way binding with .sync modifier)const boundProps = 'animation' 'clickable' 'cursor' 'draggable' // ... // Events from Google Maps emitted as Vue eventsconst redirectedEvents = 'click' 'rightclick' 'dblclick' 'drag' // ... mixins: // You need to use this mixin MapElement // When Google Maps is ready { const options = Object optionsmap = this$_map // Create Google Maps objects this$_marker = options // Bind the Vue props this // Emit the events from Google Maps this } { // Teardown if this$_marker this$_marker }
Quick Examples
Map with markers
<!-- User Position -->
Place Details
{{ props.results.name }} {{ props.results.formatted_address }}
Geocoder
{{ props.results[1].name }} {{ props.results[0].formatted_address }}
Nearby places
Loading... {{ result.name }} {{ result.vicinity }}