Skip to content

Commit ddc8f2b

Browse files
committed
【fix】判断map是否初始化逻辑
1 parent 4d0fccd commit ddc8f2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mapboxgl/mapping/InitMap.js

Lines changed: 1 addition & 1 deletion
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)