fix(@vant/use): useClickAway failed in SSR (#9899)

This commit is contained in:
neverland
2021-11-18 15:00:11 +08:00
committed by GitHub
parent e1cafe61ed
commit 0f4e9aed48

View File

@@ -1,4 +1,5 @@
import { Ref, unref } from 'vue';
import { inBrowser } from '..';
import { useEventListener } from '../useEventListener';
export type UseClickAwayOptions = {
@@ -10,6 +11,10 @@ export function useClickAway(
listener: EventListener,
options: UseClickAwayOptions = {}
) {
if (!inBrowser) {
return;
}
const { eventName = 'click' } = options;
const onClick = (event: Event) => {