mirror of https://gitee.com/antv-l7/antv-l7
feat: 兼容不同amapjs 加载方式 (#1265)
This commit is contained in:
parent
5c76bea0f5
commit
cb6dd27471
|
@ -392,11 +392,21 @@ export default class AMapService
|
|||
}
|
||||
amapLoaded = true;
|
||||
plugin.push('Map3D');
|
||||
AMapLoader.load({
|
||||
key: token, // 申请好的Web端开发者Key,首次调用 load 时必填
|
||||
version: AMAP_VERSION, // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
||||
plugins: plugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
})
|
||||
if(window.AMap) {
|
||||
Promise.resolve().then(() => {
|
||||
resolveMap();
|
||||
|
||||
if (pendingResolveQueue.length) {
|
||||
pendingResolveQueue.forEach((r) => r());
|
||||
pendingResolveQueue = [];
|
||||
}
|
||||
})
|
||||
} else {
|
||||
AMapLoader.load({
|
||||
key: token, // 申请好的Web端开发者Key,首次调用 load 时必填
|
||||
version: AMAP_VERSION, // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
||||
plugins: plugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
})
|
||||
.then((AMap) => {
|
||||
resolveMap();
|
||||
|
||||
|
@ -408,6 +418,7 @@ export default class AMapService
|
|||
.catch((e) => {
|
||||
throw new Error(e);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if ((amapLoaded && window.AMap) || mapInstance) {
|
||||
resolveMap();
|
||||
|
|
|
@ -503,13 +503,24 @@ export default class AMapService
|
|||
}
|
||||
amapLoaded = true;
|
||||
plugin.push('Map3D');
|
||||
AMapLoader.load({
|
||||
key: token, // 申请好的Web端开发者Key,首次调用 load 时必填
|
||||
version, // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
||||
plugins: plugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
})
|
||||
if(window.AMap) {
|
||||
Promise.resolve().then(() => {
|
||||
resolveMap();
|
||||
|
||||
if (pendingResolveQueue.length) {
|
||||
pendingResolveQueue.forEach((r) => r());
|
||||
pendingResolveQueue = [];
|
||||
}
|
||||
})
|
||||
} else {
|
||||
AMapLoader.load({
|
||||
key: token, // 申请好的Web端开发者Key,首次调用 load 时必填
|
||||
version: AMAP_VERSION, // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
||||
plugins: plugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
})
|
||||
.then((AMap) => {
|
||||
resolveMap();
|
||||
|
||||
if (pendingResolveQueue.length) {
|
||||
pendingResolveQueue.forEach((r) => r());
|
||||
pendingResolveQueue = [];
|
||||
|
@ -518,6 +529,7 @@ export default class AMapService
|
|||
.catch((e) => {
|
||||
throw new Error(e);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if ((amapLoaded && window.AMap) || mapInstance) {
|
||||
resolveMap();
|
||||
|
|
Loading…
Reference in New Issue