AlexLavoie42 / Nuxt-Mapbox

Elegant Mapbox integration with Nuxt
81 stars 11 forks source link

Add MapboxDefaultMarker <slot> to attach MapboxDefaultPopup #14

Closed Kalv1 closed 1 year ago

Kalv1 commented 1 year ago

Hi!

I'm putting this down here but it would be really nice to have the ability to link a popup to a marker via a slot or props ? Just like VueMapbox does. (cf Marker and Popups )

From what I've seen at the moment it's not possible to link a popup to a marker in this way (unless I'm wrong). I also tried to link with geoJson but no way to make the points display like defaultMarker while my data is valid it passes on geojson.io and displays correctly.

So I propose a syntax like :

<MapboxDefaultMarker v-for="item, index in geoSource.features" :lnglat="item.geometry.coordinates" :marker-id="`marker-${index}`" :options="{ color: '#FF00FF'}">
    <MapboxDefaultPopup>
        <div>
            <h3>{{ item.properties.name }}</h3>
            <p>{{ item.properties.description }}</p>
        </div>
    </MapboxDefaultPopup>
</MapboxDefaultMarker>

And then have the possibility to bind the click on the marker when the popup opens.

AlexLavoie42 commented 1 year ago

This should be possible currently with the marker & popup composables in a custom component. Here is some documentation on how to do it.

I will work on adding this feature in the next update though.

AlexLavoie42 commented 1 year ago

Added with #16