<template src="./Gmap.html"></template>

<script>
import GmapMixin from '../mixins/GmapMixin'
export default {
  mixins: [GmapMixin],
  props: {
    src: {type: String},
    options: {type: Object}
  },
  async mounted () {
    await this.$initializeMap(false)
    this.drawKml()
  },
  watch: {
    src () {
      this.drawKml()
    }
  },
  methods: {
    drawKml () {
      if (!this.src || this.src === '') return
      this.kmlLayer = new window.google.maps.KmlLayer(this.src, {
        ...(this.options || {}),
        map: this.map
      })
    }
  }
}
</script>
