This map exists inside of a Vue component and what I'm trying to do is use
this.$emit('somethingHappened', HighmapsEventObject)
mounted () {
Highcharts.mapChart(this.$el, {
series: [{
events: {
click: () => {
in here
}
}
}]
})
}
as in
mounted () {
Highcharts.mapChart(this.$el, {
series: [{
events: {
click: () => {
`this.$emit('somethingHappened', HighmapsEventObject)`
}
}
}]
})
}
But obviously, this
at this point, references the Highmap's this
not the Vue component's this
so I've tried to do something like this:
mounted () {
Highcharts.mapChart(this.$el, {
series: [{
events: {
click: (e) => {
this.$emit('somethingHappened', e)
}
}
}]
}).bind(this)
}
But I get:
... default.a.mapChart(...).bind is not a function
and I can't figure out how to pass the Vue component's this
to the highmaps constructor and Vue doesn't naturally listen to CustomEvent
s so I can't figure out how to dispatch the event in that callback so that Vue is aware that it happened.
mounted () {
Highcharts.mapChart(this.$el, {
series: [{
events: {
click: (e) => {
let event = new CustomEvent('mapclicked', {
detail: e
})
e.target.dispatch(event)
}
}
}]
})
}
So my question, at long last, is how do I either a: listen for CustomEvent
s in Vue, or b: bind Vue's this
to a Highmaps constructor?
Thanks SO