mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-08 08:57:15 +08:00
新增:新增前端项目模块(基于 Vue3、TypeScript、Arco Design Pro Vue 技术栈),已对接现有 API
This commit is contained in:
27
continew-admin-ui/src/utils/event.ts
Normal file
27
continew-admin-ui/src/utils/event.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export function addEventListen(
|
||||
target: Window | HTMLElement,
|
||||
event: string,
|
||||
handler: EventListenerOrEventListenerObject,
|
||||
capture = false
|
||||
) {
|
||||
if (
|
||||
target.addEventListener &&
|
||||
typeof target.addEventListener === 'function'
|
||||
) {
|
||||
target.addEventListener(event, handler, capture);
|
||||
}
|
||||
}
|
||||
|
||||
export function removeEventListen(
|
||||
target: Window | HTMLElement,
|
||||
event: string,
|
||||
handler: EventListenerOrEventListenerObject,
|
||||
capture = false
|
||||
) {
|
||||
if (
|
||||
target.removeEventListener &&
|
||||
typeof target.removeEventListener === 'function'
|
||||
) {
|
||||
target.removeEventListener(event, handler, capture);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user