派生自 wuyushui/SewerAndRainNetwork

QibolinCzp
2021-05-14 73c8d3f55d5a675174a61342f3cea712ed5bc0eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
class EventHandler {
  constructor () {
    this.map = window.map
    this.mapClickForLayers = {}
 
    window.map.on('click', (e) => {
      console.log(e)
      for (var k in this.mapClickForLayers) {
        const func = this.mapClickForLayers[k]
        console.log(func)
        func(e)
      }
    })
  }
 
  addLayerEvent (config, callback) {
    this.mapClickForLayers[config.code] = callback
  }
 
  removeEvent (config) {
    delete this.mapClickForLayers[config.code]
  }
}
 
export default EventHandler