19 lines
584 B
TypeScript
19 lines
584 B
TypeScript
export type AMapRuntimeConfig = {
|
|
webJsKey: string;
|
|
securityJsCode: string;
|
|
securityServiceHost: string;
|
|
};
|
|
|
|
export function getAMapConfig(): AMapRuntimeConfig {
|
|
const runtime = window.__LINGNIU_APP_CONFIG__ ?? {};
|
|
return {
|
|
webJsKey: String(runtime.amapWebJsKey || import.meta.env.VITE_AMAP_WEB_JS_KEY || '').trim(),
|
|
securityJsCode: String(runtime.amapSecurityJsCode || '').trim(),
|
|
securityServiceHost: String(runtime.amapSecurityServiceHost || '').trim()
|
|
};
|
|
}
|
|
|
|
export function isAMapConfigured(config = getAMapConfig()) {
|
|
return Boolean(config.webJsKey);
|
|
}
|