我试图在单击鼠标事件时创建一个弹出框。 在事件调用时,会调用popover Create()方法,但是每次执行鼠标单击事件时都会显示以下错误。 “ TypeError:ev.target.getBoundingClientRect不是函数”
代码是:
** Function.service.ts **
map.on('singleclick', function(evt: Event) {
this.presentPopover(evt);
});
async presentPopover(myEvent: Event) {
const popover = await this.popoverCtrl.create({
component: PopOverPagePage, //Generated as a page
componentProps: {
coordinates: this.coord // Coordinates captured on in someFunction() already
},
event: myEvent
});
popover.present();
}