1.1.1 • Published 1 month ago

google-map-ts-vue3 v1.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
1 month 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"
    libraries="geometry,drawing,places"
    :options="{
      center: { lat: 35.1, lng: 135.1 },
      zoom: 5,
    }"
    :markers="[
      {
        position: { lat: 35.1, lng: 135.1 },
        title: 'position1',
        draggable: false,
      },
      {
        position: { lat: 37.1, lng: 139.1 },
        title: 'position2',
        draggable: false,
      },
    ]"
    :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"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.MarkerOptions[][]MarkerOptions object
polylinesFALSEgoogle.maps.PolylineOptions[][]PolylineOptions object
polygonsFALSEgoogle.maps.PolygonOptions[][]PolygonOptions object
circlesFALSEgoogle.maps.CircleOptions[][]CircleOptions object
rectanglesFALSEgoogle.maps.RectangleOptions[][]RectangleOptions object

Events

1.1.1

1 month ago

1.1.0

4 months ago

1.0.0

4 months ago

0.4.0

8 months ago

0.3.0

2 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.1-security

3 years ago