Nuxt Google Maps Module
A NuxtJS module to import Google maps script
Table of Contents
Requirements
Install
$ npm install --save nuxt-google-maps-module
Getting Started
Add nuxt-google-maps-module
to modules
section of nuxt.config.js
.
{
modules: [
'nuxt-google-maps-module',
['nuxt-google-maps-module', {
key: 'GOOGLE MAPS KEY',
}],
]
}
or even
{
modules: [
'nuxt-google-maps-module',
],
maps: {
key: 'GOOGLE MAPS KEY',
},
}
Usage
Once configured in nuxt.config.js
, you can use it in your components like:
{
...
mounted() {
const autocomplete = new this.$google.maps.places.Autocomplete(inputElement,
{
types: ['geocode'],
},
);
},
...
}
License
MIT License