0

i try to add a marker with Nativescript-vue using @nativescript/google-maps package, bu it says map.addMarker is not function

onReady(event) {

    this.mapView = event.object;

    this.addMarker(this.mapView, this.markerOptions)

},

    addMarker(map, markerOptions) {

        const marker = map.addMarker(markerOptions);

        // You can further customize the marker if needed
        // For example: marker.icon = 'res://icon';

        return marker;

    },

1 Answer 1

0

Get map from $event not event.object.

 onMapReady({ map }) {
   this.mapView = map ;
   this.addMarker(this.mapView, this.markerOptions)
 },

 addMarker(map, markerOptions) {
     const marker = map.addMarker(markerOptions);
     return marker;
 },
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.