xkjyeah / vue-google-maps

Google maps component for vue with 2-way data binding
https://xkjyeah.github.io/vue-google-maps/
1.88k stars 474 forks source link

Applying styles to google maps #772

Open VictorCostaOliveira opened 3 years ago

VictorCostaOliveira commented 3 years ago

If you want to styling your maps like https://developers.google.com/maps/documentation/javascript/styling, you can pass to GmapMap options prop the style array who you want to apply.

Like this:

<template>
  <div class="my-app-map">
    <GmapMap
      ref="mapRef"
      :center="mapCenter"
      :zoom="15"
      map-type-id="roadmap"
      :options="mapOptions"
      style="height: 500px"
     />
  </div>
</template>
<script>
export default {
  name: 'MyAppMap',
  data() {
    return {
      mapOptions: {
        zoomControll: true,
        mapTypeControl: false,
        styles: [
          {
             featureType: 'all',
             elementType: 'all',
             anotherConfigsToGoogleMapsStyle,
          }
        ],
      }
    }
  }
}
</script>

Done, your map has your personalized styles.