index.js
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-17 12:13:13
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-12 22:50:29
* @FilePath: /tswj/src/composables/index.js
* @Description:
*/
import { onMounted, onUnmounted } from 'vue'
import { useVideoList } from '@/composables/useVideoList.js'
import { useDefaultPerf } from '@/composables/useDefaultPerf.js'
import { useBookList, useAsyncBookList } from '@/composables/useBookList.js'
import { useShortcutBar } from '@/composables/useShortcutBar.js'
import { useScrollTop } from '@/composables/useScrollTop.js'
import { useMessageList } from '@/composables/useMessageList.ts'
export {
useVideoList,
useDefaultPerf,
useBookList,
useAsyncBookList,
useShortcutBar,
useScrollTop,
useMessageList,
}
/**
* 添加和清除 DOM 事件监听器
* @param {*} target
* @param {*} event
* @param {*} callback
*/
export function useEventListener(target, event, callback) {
onMounted(() => target?.addEventListener(event, callback))
onUnmounted(() => target?.removeEventListener(event, callback))
}