import { defineComponent, onMounted, ref } from 'vue';

let ispro = process.env.NODE_ENV === 'production';
export default defineComponent({
  props: {
    map: Object,
  },
  setup(props, ctx) {
    const mapRef = ref<Element>();

    let tipcontentRef = ref<Element>();


    onMounted(() => {
      const map = new window.minemap.Map({
        container: 'map',
        style: 'http://61.147.254.211:21009/service/solu/style/id/12886' /*底图样式*/,
        center: [118.29564, 33.97441] /*地图中心点*/,
        zoom: 14 /*地图默认缩放等级*/,
        pitch: 0 /*地图俯仰角度*/,
        maxZoom: 17 /*地图最大缩放等级*/,
        minZoom: 3 /*地图最小缩放等级*/,
        // projection: 'MERCATOR',
        logoControl: false,
      });
      map["tipcontentRef"] = tipcontentRef.value;
      ctx.emit('update:map', map);
    });
    
    return () =>  (<><div id="map" style={{ height: '100%' }} ref={mapRef} /> <div class="maptip" ref={ tipcontentRef }> </div></>);
  },
});
