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

Change polygon option on event. vue google map #743

Open Ghostff opened 4 years ago

Ghostff commented 4 years ago

Am trying to change the the stroke color of a polygon on mouseover. The issue is, I don't know/cant find an appropriated documentation on how to access the setOptions method from events.

Initially created: https://stackoverflow.com/questions/63785165/change-polygon-option-on-event-vue-google-map

<GmapMap ref="google_map" :center="{ lat: 0, lng: -0 }">
    <gmap-polygon
        v-for="(polygon, i) in polygons"
        ref="google_map_polygon"
        :key="`polygon-${i}`"
        :paths="polygon.vertices"
        :options="polygonOptions"
        @mouseover="polygonHover"
    />
</GmapMap>

Js

export default {
    data: () => ({
        polygons: [],
        polygonOptions: {
            strokeColor: 'transparent',
        }
    }),
    ...
    methods: {
        polygonHover (event) {
            // Change strokeColor here.
        }
    }
}
nndproject commented 3 years ago

@Ghostff sir, can you give me sample action in method plygonHover for change color or strokeweight? cz iam try but still not working :(