policeSecurity/superManagement/src/utils/aMapUtil.ts

19 lines
526 B
TypeScript
Raw Normal View History

import AMapLoader from "@amap/amap-jsapi-loader";
type Amap = typeof AMap;
export const initMap = (plugins?: string[]): Promise<Amap> => new Promise((resolve, reject) => {
//@ts-ignore
window._AMapSecurityConfig = {
securityJsCode: '432125a0f8d8cad2dac38b77d6f6728f'
}
AMapLoader.load({
key: __APP_ENV.VITE_APP_GAODE_KEY,
version: __APP_ENV.VITE_APP_GAODE_VERSION,
plugins
}).then((AMap: Amap) => {
resolve(AMap)
}).catch(err => {
reject(err)
})
})