[Vuejs]-Google maps click event isn't reading objects from data

0👍

The context is changing. Inside the click handler, the this is not referring to the Vue instance, but something else (it depends on how google maps does it, but it could be window or the map instance).

To have the this be the Vue instance, use arrow functions instead.

Change from:

google.maps.event.addListener(map, "click", function(event) {

To:

google.maps.event.addListener(map, "click", (event)  => {

Leave a comment