1

Im new to nuxt, and trying to use an external source (google api in this case). Following the reference: https://nuxtjs.org/faq/ I see that the script is added to the head of my index.html. But how do I use it?

Currently I have this in the mounted event:

 mounted: function () {
      const element = document.getElementById(this.mapName)
      const options = {
        zoom: 14,
        center: new google.maps.LatLng(51.501527, -0.1921837)
      }
      const map = new google.maps.Map(element, options)
    }

But I get the error:

'google' is not defined

Thanks!

M. Suurland
  • 725
  • 12
  • 31

1 Answers1

1

Got it, you can enter it by: window.google

M. Suurland
  • 725
  • 12
  • 31