refresh leaflet map: map container is already initialized

后端 未结 17 1122
鱼传尺愫
鱼传尺愫 2020-11-27 04:16

I have a page where given a select to the user he can switch the leaflet map I show.

After a initial leaflet map load, my problem is when i want to refresh the map.

17条回答
  •  情书的邮戳
    2020-11-27 04:46

    the best way

    map.off();
    map.remove();
    

    You should add map.off(), it also works faster, and does not cause problems with the events

提交回复
热议问题