mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(hooks): [use-lockscreen] fix lock-scroll not working (#19711)
* fix(hooks): [use-lockscreen] fix lock-scroll not working closed #19708 * fix(hooks): update * chore: add test --------- Co-authored-by: qiang <qw13131wang@gmail.com>
This commit is contained in:
@@ -105,4 +105,26 @@ describe('useLockscreen', () => {
|
||||
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('should not cleanup when newly created during the closing process', async () => {
|
||||
const wrapper1 = mount({
|
||||
setup: () => () => <Comp />,
|
||||
})
|
||||
|
||||
await nextTick()
|
||||
expect(hasClass(document.body, kls)).toBe(true)
|
||||
|
||||
wrapper1.unmount()
|
||||
const wrapper2 = mount({
|
||||
setup: () => () => <Comp />,
|
||||
})
|
||||
vi.advanceTimersByTime(250)
|
||||
await nextTick()
|
||||
expect(hasClass(document.body, kls)).toBe(true)
|
||||
|
||||
wrapper2.unmount()
|
||||
vi.advanceTimersByTime(250)
|
||||
await nextTick()
|
||||
expect(hasClass(document.body, kls)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
getScrollBarWidth,
|
||||
getStyle,
|
||||
hasClass,
|
||||
isClient,
|
||||
removeClass,
|
||||
throwError,
|
||||
} from '@element-plus/utils'
|
||||
@@ -38,10 +37,6 @@ export const useLockscreen = (
|
||||
|
||||
const hiddenCls = computed(() => ns.bm('parent', 'hidden'))
|
||||
|
||||
if (!isClient || hasClass(document.body, hiddenCls.value)) {
|
||||
return
|
||||
}
|
||||
|
||||
let scrollBarWidth = 0
|
||||
let withoutHiddenClass = false
|
||||
let bodyWidth = '0'
|
||||
|
||||
Reference in New Issue
Block a user