Skip to main content

Global Properties

We have two main global properties

  1. $gmapApiPromiseLazy
  2. $gmapOptions.

You can access these properties as follows

Options API

[your-component].vue
export default {
mounted() {
this.$gmapApiPromiseLazy().then(...).catch(...);
this.$gmapOptions;
}
}

Composition API

You can use the following composables

[your-component].vue
import { usePluginOptions, useGoogleMapsApiPromiseLazy } from '@gmap-vue/v3/composables';

const options = usePluginOptions();
const googleMapsApiPromiseLazy = useGoogleMapsApiPromiseLazy();

Getting the plugin options with inject

[your-component].vue
import { $gmapOptions } from '@gmap-vue/v3/keys';
import { inject } from 'vue';

const options = inject($gmapOptions);
info
  • Check the useGoogleMapsApiPromiseLazy object here
  • Check the usePluginOptions object here