fix(hooks): [lockscreen] body lock remove unexpected (#4693) (#4694)

Co-authored-by: KawaiiZapic <kawaiizapic@zapic.moe>
This commit is contained in:
Zapic 2021-12-07 17:25:50 +08:00 committed by GitHub
parent 812b1b8b80
commit d2ab3844b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import {
hasClass, hasClass,
getStyle, getStyle,
} from '@element-plus/utils/dom' } from '@element-plus/utils/dom'
import isServer from '@element-plus/utils/isServer'
import type { Ref } from 'vue' import type { Ref } from 'vue'
@ -23,6 +24,10 @@ export const useLockscreen = (trigger: Ref<boolean>) => {
'You need to pass a ref param to this function' 'You need to pass a ref param to this function'
) )
} }
if (isServer || hasClass(document.body, 'el-popup-parent--hidden')) {
return
}
let scrollBarWidth = 0 let scrollBarWidth = 0
let withoutHiddenClass = false let withoutHiddenClass = false
let bodyPaddingRight = '0' let bodyPaddingRight = '0'