1.2.1 • Published 7 months ago

google-map-ts-vue3 v1.2.1

Weekly downloads
5
License
MIT
Repository
github
Last release
7 months ago

google-map-ts-vue3

npm version TypeScript License: MIT code style: prettier

Google Maps component implemented in Vue3.

Example

<script setup lang="ts">
import { GoogleMap } from "google-map-ts-vue3";
</script>

<template>
  <GoogleMap
    apiKey="your google maps api key"
    :options="{
      center: { lat: 35.1, lng: 135.1 },
      zoom: 5,
      mapId: 'DEMO_MAP_ID' // Map ID is required for advanced markers.
    }"
    :markers="[
    {
        position: { lat: 35.1, lng: 135.1 },
        title: 'position1'
      },
      {
        position: { lat: 37.1, lng: 139.1 },
        title: 'position2'
      },
    ]"
    :polylines="[
      {
        path: [
          { lat: 35.1, lng: 135.1 },
          { lat: 37.1, lng: 139.1 },
        ],
        geodesic: true,
        strokeColor: '#ff0000',
        strokeOpacity: 1.0,
        strokeWeight: 2,
      },
      {
        path: [
          { lat: 38.1, lng: 136.1 },
          { lat: 34.1, lng: 135.1 },
          { lat: 37.1, lng: 139.1 },
        ],
        geodesic: true,
        strokeColor: '#ffffff',
        strokeOpacity: 1.0,
        strokeWeight: 2,
      },
    ]"
    :polygons="[
      {
        paths: [
          { lat: 30, lng: 140 },
          { lat: 31, lng: 141 },
          { lat: 30, lng: 145 },
          { lat: 33, lng: 140 },
        ],
        strokeColor: '#ff0000',
        strokeOpacity: 0.8,
        strokeWeight: 3,
        fillColor: '#ff0000',
        fillOpacity: 0.35,
      },
    ]"
    :circles="[
      {
        strokeColor: '#ff0000',
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: '#ff0000',
        fillOpacity: 0.35,
        center: { lat: 39.1, lng: 140.1 },
        radius: 100000,
      },
    ]"
    :rectangles="[
      {
        strokeColor: '#ff0000',
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: '#ff0000',
        fillOpacity: 0.35,
        bounds: {
          north: 30,
          south: 33,
          east: 133,
          west: 130,
        },
      },
    ]"
  />
</template>

Props

PropsRequiredParam TypeDefault valueDescription
apiKeyTRUEstringGoogle Maps API Key
scriptLoadingTimeoutFALSEnumber5000Timeout for loading the Google Map script
librariesFALSEstring"marker,geometry,drawing,places"Libraries to load
heightFALSEstring"500px"The height of Google Maps
widthFALSEstring"500px"The width of Google Maps
optionsTRUEgoogle.maps.MapOptionsMapOptions object
markersFALSEgoogle.maps.marker.AdvancedMarkerElementOptions[][]AdvancedMarkerElementOptions object
polylinesFALSEgoogle.maps.PolylineOptions[][]PolylineOptions object
polygonsFALSEgoogle.maps.PolygonOptions[][]PolygonOptions object
circlesFALSEgoogle.maps.CircleOptions[][]CircleOptions object
rectanglesFALSEgoogle.maps.RectangleOptions[][]RectangleOptions object

Events

1.2.0

7 months ago

1.2.1

7 months ago

1.1.2

7 months ago

1.1.1

9 months ago

1.1.0

11 months ago

1.0.0

11 months ago

0.4.0

1 year ago

0.3.0

2 years ago

0.2.5

3 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.1-security

4 years ago