chore: remove hooks ooops!

This commit is contained in:
陈嘉涵
2020-01-14 17:19:03 +08:00
parent 046ce7e2fe
commit 8d4d965a85
4 changed files with 0 additions and 185 deletions
-21
View File
@@ -1,21 +0,0 @@
import { Ref } from 'vue';
import { useGlobalEvent } from './use-global-event';
export type UseClickOutsideOpitons = {
event: string;
callback: EventListener;
element: Ref<Element>;
flag?: Ref<boolean>;
};
export function useClickOutside(options: UseClickOutsideOpitons) {
const { event = 'click', callback, element, flag } = options;
function onClick(event: Event) {
if (!element.value.contains(event.target as Node)) {
callback(event);
}
}
useGlobalEvent(document, event, onClick, false, flag);
}