mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 17:51:54 +00:00
fix(@vant/use): useClickAway failed in SSR (#9899)
This commit is contained in:
@@ -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) => {
|
||||
|
Reference in New Issue
Block a user