ant-design-vue/components/_util/triggerEvent.ts
2020-10-13 22:26:56 +08:00

9 lines
247 B
TypeScript

export default function triggerEvent(el: Element, type: string) {
if ('createEvent' in document) {
// modern browsers, IE9+
const e = document.createEvent('HTMLEvents');
e.initEvent(type, false, true);
el.dispatchEvent(e);
}
}