1

我正在做一个我使用 3d 地图的离子项目。在这个项目中,我在地图上创建了一个标记,在这个标记上我想要点击事件。以下是我的代码

//import Wrld from 'wrld.js';
import * as eeGeo from '../../assets/js/eegeo';
import 'rxjs/add/operator/map';


ionViewDidLoad() {
    this.map = eeGeo.map("map", "57c2476b17a6a45fa03e4b8d042235d1", {
      center: [37.7858, -122.401],
      zoom: 16,
      indoorsEnabled: true,
      displayEntranceMarkers: true
    });
  }

  selectitem(item)
       {
         this.searchbar = false;
         this.cardhaed = item.title;
         this.floor = item.floor
         console.log(this.floor);

         this.lat = item.latitude;
         this.lng = item.longitude;
         this.addmarker(item);
  }
  addmarker(item)
  {

      this.marker  = eeGeo.marker([this.lat, this.lng], {
        title: item.title,
        indoorsEnabled: true,      
        indoorMapId: item.indoorid,
        displayEntranceMarkers: false,
        indoorMapFloorId: item.id
      }).addTo(this.map);

     this.marker.on('click', function(e) {
       alert(e.latlng);
  });

但在这种情况下,on 事件不起作用。有什么帮助吗???

4

0 回答 0