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);