Fork me on GitHub

const elems = document.elementsFromPoint(e.pageX, e.pageY);
const instance = elems.filter(elem => elem.classList.contains('meeting-hover-card'));
   if (instance.length > 0) {
           this.instance = instance[0];
           this.fireEvent(this.instance, 'mouseover');
    }

  使用document.elementsFromPoint能穿透获取dom节点,通过dispatchEvent模拟事件

 const evObj = document.createEvent('Events');
    evObj.initEvent(eventName, true, false);
    elem.dispatchEvent(evObj);

 

posted on 2019-03-21 16:33  huashiyiqike  阅读(834)  评论(0编辑  收藏  举报