<template>
  <div class="map-container">
    <mars-map :url="configUrl" :options="options" @onload="onMapload" />
    <slot name="select"></slot>
  </div>
</template>

<script>
import MarsMap from "@/components/mars-work/mars-map.vue";

export default {
  // http://39.101.188.84:9999/demo/tc-community/lib/geoJson/xiaoqu.json
  data() {
    const basePathUrl = window.basePathUrl || "";
    return {
      configUrl: basePathUrl + "lib/config/config.json",
      tiles3dLayer: null,
      map: null,
      baseUrl: basePathUrl + "lib/geoJson",
    };
  },
  props: {
    show: {
      type: Number,
      default: 1,
    },
    // 自定义参数
    options: Object,
  },

  components: {
    MarsMap,
  },
  methods: {
    onMapload(map) {
      this.map = map;
      // const OfflineCache = CesiumNetworkPlug.OfflineCacheController;
      // console.log(this.baseUrl, "sssss");

      // // ① 全局缓存
      // // OfflineCache.ruleList.add("*")
      // // ② 对指定地址的 瓦片图层 缓存
      // OfflineCache.ruleList.add("https://services.arcgisonline.com/");

      this.$emit("mapLoad", map);
    },
  },
};
</script>

<style lang="scss" scoped>
.map-container {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #00448d;
}
</style>
