Closed agracia-foticos closed 1 year ago
At the moment none of the component properties are reactive to changes since the mapbox objects are created on initialization and passed a copy of the properties. This is something I will work on adding at some point (Some components will probably need to be reloaded entirely).
I was not able to reproduce the same error you showed after fixing the reproduction (missing setup
tag in script & invalid API key) but the markers do not respond to changes.
For a marker to move its position right now, I believe you need to call setLngLat
on the marker with the changed coordinates.
Fixed in #28
@AlexLavoie42 don't runs with new version :(
If you are referring to the reproduction you sent, you need to make sure you use setup
in your script tag or the vue composition api wont work https://vuejs.org/guide/typescript/composition-api.html
Also, the markers wont render unless you give a valid api key. After fixing it here it seems to work for me just fine.
https://stackblitz.com/edit/nuxt-starter-zfc59i
I change this reproduction link, updating to latest version, but the markers don`t refresh :(
Obviously I'm not going to show my mapbox AKI key in the link :P
<MapboxMap :map-id="mapId" :options="optionsMap" >
<MapboxDefaultMarker :lnglat="[pickpoint.geo_2, pickpoint.geo_1]" v-for="pickpoint in pickpoints.items" :marker-id="`marker-${pickpoint.pickpoint_id}`" :key="pickpoint.pickpoint_id" />
</MapboxMap>
If i change the pickpoints, dont refresh them
You still have the same issue, you are putting template
in your script tag instead of setup
. This will break the composition API in Vue entirely. https://vuejs.org/guide/introduction.html#composition-api
Once again after fixing that and using my own API key (you can use the one in the playground if you dont want to provide your own) it works fine. https://stackblitz.com/edit/nuxt-starter-4qtfrz
We have this reproduction link example https://stackblitz.com/edit/nuxt-starter-zfc59i
When i'm trying to refresh v-for MapboxDefaultMarker object, throws me and error![image](https://github.com/AlexLavoie42/Nuxt-Mapbox/assets/77386602/fc99fc52-05a4-4a7f-b995-cba4efd36f42)
The object pickpoints is refreshed, but throws an error![image](https://github.com/AlexLavoie42/Nuxt-Mapbox/assets/77386602/3a22e4fe-0885-4b59-9e9a-a57a111a73a7)