[Vuejs]-How do I substitute a value from axios to input?

1👍

You should change your code:

onMarkerClick(event, name) { this.name = name; }

or to this code:

onMarkerClick(event, name) { this.$set(this, "name", name); }

0👍

You should pass the m variable in your v-for into change onMarkerClick. Change your code to this

<gmap-marker
      :key="index"
      v-for="(m, index) in markers"
      :position="m.position"
      :clickable="true"
      :draggable="false"
      @click="onMarkerClick(m)"
    ></gmap-marker>

  </gmap-map>

Now in your clickMarker function should be like this.

onMarkerClick(name) {
    this.name = name;
}, 

Leave a comment