4.0.2 • Published 4 years ago

v-maps v4.0.2

Weekly downloads
16
License
MIT
Repository
github
Last release
4 years ago

v-maps

Build Status

A simple Google Maps component for Vue

Live Demo

Install

run:

yarn add v-maps

or:

npm install v-maps --save

Usage

  • Globally registration:

      import Vue from 'vue'
      import VMaps from 'v-maps'
      
      // { key: string, version?: string, libraries?: Array<string> }
      const googleApiOptions = { key: 'YOUR_GOOGLE_MAPS_API_KEY' }
      Vue.use(VMaps, googleApiOptions)
    • using global registration in component

      <template>
        <v-map :center="{ lat: -23.4070511, lng: -51.9428867 }" />
      </template>
    • using global registration map with markers

      <template>
        <v-map :center="center">
          <v-marker :position="center" />
        </v-map>
      </template>
      
      <script>
        export default {
          computed: {
            center() {
              return { lat: -23.4070511, lng: -51.9428867 }
            }        
          }
        }
      </script>
    • using global registration map with polygon

    <template>
      <v-map :center="center">
        <v-polygon :paths="polygonPaths" />
      </v-map>
    </template>
    
    <script>
      export default {
        data() {
          return { polygonPaths: [] }
        },
    
        computed: {
          center() {
            return { lat: -23.4070511, lng: -51.9428867 }
          }        
        }
      }
    </script>
    • using global registration map with polyline
    <template>
      <v-map :center="center">
        <v-polyline :path="polylinePath" />
      </v-map>
    </template>
    
    <script>
      export default {
        data() {
          return { polylinePath: [] }
        },
    
        computed: {
          center() {
            return { lat: -23.4070511, lng: -51.9428867 }
          }        
        }
      }
    </script>
  • Locally registration

    <template>
      <v-map :center="center" api-key="YOUR_GOOGLE_MAPS_API_KEY">
        <v-marker :position="center" />
        <v-polygon :paths="polygonPaths" />
        <v-polyline :path="polylinePath" />
      </v-map>
    </template>
    
    <script>
      import { VMap, VMarker, VPolygon, VPolyline } from 'v-maps'
    
      export default {
        data() {
          return { polygonPaths: [], polylinePath: [] }
        },
    
        computed: {
          center() {
            return { lat: -23.4070511, lng: -51.9428867 }
          }        
        },
        components: { VMarker, VMap, VPolygon, VPolyline }
      }
    </script>

Props

Events

  • v-map(for more details check the google documentation in https://developers.google.com/maps/documentation/javascript/events)

    Vue EventParamsNative google map event
    bounds-changedmap, eventbounds_changed
    center-changedmap, eventcenter_changed
    clickmap, eventclick
    double-clickmap, eventdblclick
    dragmap, eventdrag
    drag-endmap, eventdragend
    drag-startmap, eventdragstart
    heading-changedmap, eventheading_changed
    idlemap, eventidle
    map-type-id-changedmap, eventmaptypeid_changed
    mouse-movemap, eventmousemove
    mouse-outmap, eventmouseout
    mouse-overmap, eventmouseover
    projection-changedmap, eventprojection_changed
    resizemap, eventresize
    right-clickmap, eventrightclick
    tiles-loadedmap, eventtilesloaded
    tilt-changedmap, eventtilt_changed
    zoom-changedmap, eventzoom-changed
  • v-marker

    Vue EventParamsInfo
    clickNoneThis only works if the marker has no info window
  • v-polygon

    Vue EventParamsNative google map event
    path-changedCurrent paths of polygon
  • v-polyline

    Vue EventParamsNative google map event
    path-changedCurrent paths of polyline
3.0.13

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.12

4 years ago

3.0.11

4 years ago

3.0.10

4 years ago

3.0.9

4 years ago

3.0.8

4 years ago

3.0.7

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago