Skip to content

Commit 8611976

Browse files
committed
fix(useMouseInElement): SSR compatibility
1 parent 223d069 commit 8611976

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/core/useMouseInElement/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { MaybeRef } from '@vueuse/shared'
22
import { ref, watch } from 'vue-demi'
33
import { MouseOptions, useMouse } from '../useMouse'
4+
import { defaultWindow } from '../_configurable'
45

56
export interface MouseInElementOptions extends MouseOptions {
67
handleOutside?: boolean
@@ -17,7 +18,10 @@ export function useMouseInElement(
1718
target?: MaybeRef<Element | null | undefined>,
1819
options: MouseInElementOptions = {},
1920
) {
20-
const { handleOutside = true } = options
21+
const {
22+
handleOutside = true,
23+
window = defaultWindow,
24+
} = options
2125
const { x, y, sourceType } = useMouse(options)
2226

2327
const targetRef = ref(target || window?.document.body)

0 commit comments

Comments
 (0)