Skip to content

Commit fd9c073

Browse files
committed
【fix】判断map是否初始化逻辑
1 parent d1180ef commit fd9c073

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mapboxgl/mapping/InitMap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function initMap(url, options = {}) {
5555
}
5656
const mapOptions = await createMapOptions(url, res.result, { ...options, initMapService });
5757
const map = new mapboxgl.Map(mapOptions);
58-
if (mapOptions.style && mapOptions.style.layers && mapOptions.style.layers.length > 0) {
58+
if (!map.loaded()) {
5959
map.on('load', () => {
6060
resolve({ map });
6161
});

0 commit comments

Comments
 (0)