|
@@ -1,23 +1,23 @@
|
|
|
-import AMapLoader from '@amap/amap-jsapi-loader'
|
|
|
|
|
|
|
+import AMapLoader from "@amap/amap-jsapi-loader";
|
|
|
|
|
|
|
|
-let AMapInstance: any = null
|
|
|
|
|
|
|
+let AMapInstance: any = null;
|
|
|
|
|
|
|
|
export async function loadAMap(): Promise<any> {
|
|
export async function loadAMap(): Promise<any> {
|
|
|
- if (AMapInstance) return AMapInstance
|
|
|
|
|
|
|
+ if (AMapInstance) return AMapInstance;
|
|
|
|
|
|
|
|
return AMapLoader.load({
|
|
return AMapLoader.load({
|
|
|
- key: '88a0c82c3f60a748c6c638ef9db16bca',
|
|
|
|
|
- version: '2.0',
|
|
|
|
|
|
|
+ key: import.meta.env.VITE_AMAP_KEY,
|
|
|
|
|
+ version: "2.0",
|
|
|
plugins: [
|
|
plugins: [
|
|
|
- 'AMap.Geolocation',
|
|
|
|
|
- 'AMap.Scale',
|
|
|
|
|
- 'AMap.ToolBar',
|
|
|
|
|
- 'AMap.Marker',
|
|
|
|
|
- 'AMap.InfoWindow',
|
|
|
|
|
- 'AMap.Geocoder',
|
|
|
|
|
|
|
+ "AMap.Geolocation",
|
|
|
|
|
+ "AMap.Scale",
|
|
|
|
|
+ "AMap.ToolBar",
|
|
|
|
|
+ "AMap.Marker",
|
|
|
|
|
+ "AMap.InfoWindow",
|
|
|
|
|
+ "AMap.Geocoder",
|
|
|
],
|
|
],
|
|
|
}).then((AMap: any) => {
|
|
}).then((AMap: any) => {
|
|
|
- AMapInstance = AMap
|
|
|
|
|
- return AMap
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ AMapInstance = AMap;
|
|
|
|
|
+ return AMap;
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|