vue2-google-maps add cusome marker in vue.js

1.5k Views Asked by At

I am integrating google maps functionality using vue2-google-maps. I am able to show default marker in my application but when I tried it for custom market it shows nothing on the map.

Following is my code.

<gmap-map
        :center="center"
        :zoom="17"
        style="width:100%;  height: 350px;"
      >
        <gmap-marker
          :key="index"
          v-for="(m, index) in markers"
          :position="m.position"
          :icon="{url:'../assets/markerIcon.png'}"
          @click="center=m.position"></gmap-marker>
      </gmap-map>

Can anyone solve my problem why I am not able to see custom marker on map?

1

There are 1 best solutions below

0
On

Try change :icon="{url:'../assets/markerIcon.png'}" to :icon="{url:require('../assets/markerIcon.png')}