fix(hooks): [lockscreen] compatible with document non-existence (#18445)

This commit is contained in:
btea 2024-10-04 21:59:47 +08:00 committed by GitHub
parent 27e0c496e8
commit ef822ded7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,9 @@ export const useLockscreen = (
const cleanup = () => {
setTimeout(() => {
// When the test case is running, the context environment simulated by jsdom may have been destroyed,
// and the document does not exist at this time.
if (typeof document === 'undefined') return
removeClass(document?.body, hiddenCls.value)
if (withoutHiddenClass && document) {
document.body.style.width = bodyWidth