feat(all): add sub-setting

This commit is contained in:
zyronon
2023-09-12 18:52:11 +08:00
parent a2b1d7b492
commit df22b4229e
15 changed files with 346 additions and 121 deletions

12
src/hooks/event.ts Normal file
View File

@@ -0,0 +1,12 @@
import {onMounted, onUnmounted} from "vue";
import {emitter, EventKey} from "@/utils/eventBus.ts";
export function useWindowClick(cb: () => void) {
onMounted(() => {
emitter.on(EventKey.closeOther, cb)
window.addEventListener('click', cb)
})
onUnmounted(() => {
window.removeEventListener('click', cb)
})
}