title: VueJS, ReferenceError: google is not defined
body: <p>I have the following source code and I got also the following error when I try to instantiate a new var with <code>google.maps ...</code>:</p>
  
  <blockquote>
    <p>google' is not defined</p>
  </blockquote>
  
  <p>Many of the answers talked about loading the API script asyncronously before everything else, and the order of the scripts matters, but I don't think that's my issue.</p>
  
  <p>PS: I use this in the <code>main.js</code> </p>
  
  <pre class="lang-vue prettyprint-override"><code>Vue.use(VueGoogleMaps, {    
    load: {    
      key: 'MY-KEY',    
      libraries: 'places', //// If you need to use place input    
    },    
  })     
  </code></pre>
  
  <p>Can anyone help me? Thanks.</p>
  
  <pre class="lang-vue prettyprint-override"><code>&lt;div class="map-container"&gt;     
         &lt;gmap-map     
           id="map"     
           ref="map"     
           :center="center"     
           :zoom="15"     
           map-type-id="roadmap"     
           style="width:100%;  height: 400px;"&gt;     
             &lt;gmap-marker     
             :key="index"    
              v-for="(m, index) in markers"    
              :position="m.position"    
               @click="center=m.position"    
               &gt;&lt;/gmap-marker&gt;    
                  &lt;/gmap-map&gt;
              &lt;/div&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>&lt;script&gt;    
      import _ from 'lodash'    
      import { mapState } from 'vuex'    
      import * as VueGoogleMaps from 'vue2-google-maps'   
  
      export default {    
        computed: {    
          ...mapState([    
            'map',    
          ]),    
          mapStyle: function () {     
            const h = document.body.clientHeight - 80    
            return 'width: 100%; height: ' + h + 'px'    
          },    
          center: function () {    
            return { lat: 44.837938, lng: -0.579174 }    
          },    
        },    
        mounted: function () {    
          VueGoogleMaps.loaded.then(() =&gt; {
             var map = new google.maps.Map(document.getElementById('map'))    
          }
        }, 
  </code></pre>