Closed zhaoweizhong closed 5 months ago
The map should be persistent across routes and should not need a reload. I am unsure if you are using multiple different maps across routes but that seems like the problem here.
For each map, you need to ensure that it has its own unique key that will remain the same for each map even on different routes. The problem with using timestamp is that the id changes all the time so the module creates a new map using the new id. Instead, just ensure you give a unique string for each maps id.
Of course I am just speculating here since I can't see your code. If you need further help please send a reproduction link using Stackblitz.
Thank you. I just located the problem, please check: https://stackblitz.com/edit/nuxt-starter-1nnuc9
When using multiple layouts and navigating from a page that contains a Map to another page with a different layout, then navigating back again, the Map component will disappear.
I'm not sure if it is an issue with this module, or just my problem on implementation.
When using
NuxtLink
orrouter.push()
for navigation, I encounter an issue where the map disappears each time I navigate to a different page and then return.I tried a workaround by assigning a random number to the map ID like
:map-id="`map-${timestamp}`"
so that the map component can be re-rendered every time. However, it results in the map controls persisting, resulting in duplicate controls appearing after each navigation:Can anyone suggest a solution to this problem?