import AMapLoader from "@amap/amap-jsapi-loader"; export default class map{ static key = '16c1afa83d703d8c73ef0a64f150d000' static map = null static constructor(){ if(!this.map){ this.initAMap() } } static async initAMap(){ let map = await AMapLoader.load({ key:key, // 申请好的Web端开发者Key,首次调用 load 时必填 version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 plugins: ["AMap.RangingTool"], //支持添加多个如:['...','...'] }) console.log(map) this.map = map } }