<template>
    <div class="stationmap">
        <div  id="mapid">

        </div>
    </div>
</template>
<script>
  import { setTimeout } from 'timers';
import leaflet from '../../assets/risk_point/js/leaflet'

export default {
    name: "stationmap1",
    props:['mapImg', 'mapArr'],
    data() {
        return {
          map:null,
          itmeList:null,
          dataList : [],
        }
    },
    mounted(){
      leaflet.sendThis(this); //发送this 到 leaflet.js 文件里

      this.dataList = this.mapArr;
      console.log(this.dataList );

      //自定义地图
      // this.getMapFn();

      this.getDrawFn();

     /* this.$nextTick(function () {
        this.$on('setValue', function () {
          console.log('监听成功')
        })
      })
     */

    },
    methods:{
      getValue(){
        console.log('setValue');
        this.mounted();
      },
      getDrawFn(){
        let domId = 'mapid';
        let ip = this.$ip;
        let mapImg = this.mapImg;
        let dataList = this.dataList;

        leaflet.getMapFn(domId, ip, mapImg, dataList, function (res, target) {

            // 点击事件返回参数
            console.log('leaflet.getMapFn______________________________________',res, target);
        });
      },

    }
}
</script>
<style lang="less" lang="scss" type="text/scss">
    @import "../../assets/risk_point/css/leaflet.css";
    .stationmap{
        width: 100%;
        height: 100%;
        /*font-size: 0.1rem;*/
        #mapid{
            width: 100%;
            height: calc(100vh - 1.03rem);
        }
    }

</style>
