Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.
Discussion options

You must be logged in to vote

Can you try this solution?

 data() {
    return {
      markers: [],
    };
  },
  methods: {

    fitBoundsOnMap() {
      this.$refs.googleMapRef.$mapPromise.then((mapObject) => {

        var bounds = new google.maps.LatLngBounds();

        this.markers.forEach((marker) => {
          bounds.extend(marker.position);
        });

        mapObject.fitBounds(bounds);
      });
    },
},

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@felixranesberger
Comment options

@felixranesberger
Comment options

Answer selected by tahaipek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
advise or question Seeking for advise or question
3 participants