@codekraft-studio/vue-google-map

0.1.3 • Public • Published

vue-google-map

Google Map components and integration for VueJs

NPM version Dependency Status

This package is under active development, the documentation is not complete yet, so if is missing something open a request or look at the source code.

Installation

npm i @codekraft-studio/vue-google-map
yarn add @codekraft-studio/vue-google-map

Usage

Before starting you need a Google API key from the developer console, once you obtained your key, import the module in your application and register it as plugin:

import VueGoogleMap from '@codekraft-studio/vue-google-map'

Vue.use(VueGoogleMap, {
  load: {
    apiKey: 'your-api-key',
    libraries: ['...']
  }
})

This module tries to map GoogleMap with Vue components as much as possible so any of the options available on the original GoogleMap class will be available as component props and all the events emitted will be mapped to component events.

Components

Here a list of the available components that you can use with this plugin, click on them to discover more about the usage and see examples. If you are interested to see a real life use checkout the example folder which contains the source code of the website.

Marker

The Google Map Marker element require to be inside a <google-map> component., it support the default slot.

<google-map-marker
  title="String"
  label="String|Object"
  clickable="Boolean"
  draggable="Boolean"
  visible="Boolean"
  z-index="Number"
  click="Function"
  dblclick="Function"
  rightclick="Function"
  drag="Function"
  dragstart="Function"
  dragend="Function"
  mouseup="Function"
  mousedown="Function"
  mouseover="Function"
  mouseout="Function"
></google-map-marker>

AutoComplete

The AutoComplete component does not require to be inside a <google-map> component, it can be used anyway inside your app. It display an input and optionally the autocomplete controls, when a place is selected the place-changed event is triggered with the result.

<google-map-autocomplete
  model="String"
  types="Array"
  controls="Boolean"
  update-map="Boolean"
  place-changed="Function"
></google-map-autocomplete>

Development

If you want to contribute in the development clone or fork the repository, than install all the dependencies:

npm install
yarn install

Create a .env file containing the VUE_APP_GOOGLE_APIKEY variable with your valid API key:

VUE_APP_GOOGLE_APIKEY=my-apy-key

License

This package is under the MIT License.

Package Sidebar

Install

npm i @codekraft-studio/vue-google-map

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

1.52 MB

Total Files

10

Last publish

Collaborators

  • erikyo
  • b4dnewz