8000 fix(useFullscreen): get the correct initial state while mounted (#4745) · vueuse/vueuse@09cbd3e · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 09cbd3e

Browse files
ben-lauliubaobin
andauthored
fix(useFullscreen): get the correct initial state while mounted (#4745)
Co-authored-by: liubaobin <liubaobin@wps.cn>
1 parent b171893 commit 09cbd3e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/core/useFullscreen/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ConfigurableDocument } from '../_configurable'
22
import type { MaybeElementRef } from '../unrefElement'
3-
import { tryOnScopeDispose } from '@vueuse/shared'
3+
import { tryOnMounted, tryOnScopeDispose } from '@vueuse/shared'
44
import { computed, shallowRef } from 'vue'
55
import { defaultDocument } from '../_configurable'
66
import { unrefElement } from '../unrefElement'
@@ -160,6 +160,8 @@ export function useFullscreen(
160160
useEventListener(document, eventHandlers, handlerCallback, listenerOptions)
161161
useEventListener(() => unrefElement(targetRef), eventHandlers, handlerCallback, listenerOptions)
162162

163+
tryOnMounted(handlerCallback, false)
164+
163165
if (autoExit)
164166
tryOnScopeDispose(exit)
165167

0 commit comments

Comments
 (0)
0