修改数据结构
This commit is contained in:
7
src/hooks/useEvent.ts
Normal file
7
src/hooks/useEvent.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
// event.js
|
||||
import {onMounted, onUnmounted} from 'vue'
|
||||
|
||||
export function useEventListener(type: string, listener: EventListenerOrEventListenerObject) {
|
||||
onMounted(() => window.addEventListener(type, listener))
|
||||
onUnmounted(() => window.removeEventListener(type, listener))
|
||||
}
|
||||
Reference in New Issue
Block a user