Browse Source

fix: fix abnormal display of scroll bar on lock screen page (#4546)

*  fix abnormal display of scroll bar on lock screen page
pull/4548/head
Squall2017 2 years ago
committed by GitHub
parent
commit
b7776c5148
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      packages/@core/composables/src/use-scroll-lock.ts
  2. 1
      packages/effects/layouts/package.json
  3. 3
      packages/effects/layouts/src/widgets/lock-screen/lock-screen.vue
  4. 3
      pnpm-lock.yaml

4
packages/@core/composables/src/use-scroll-lock.ts

@ -2,8 +2,8 @@ import { getScrollbarWidth, needsScrollbar } from '@vben-core/shared/utils';
import {
useScrollLock as _useScrollLock,
tryOnBeforeMount,
tryOnBeforeUnmount,
tryOnMounted,
} from '@vueuse/core';
export const SCROLL_FIXED_CLASS = `_scroll__fixed_`;
@ -12,7 +12,7 @@ export function useScrollLock() {
const isLocked = _useScrollLock(document.body);
const scrollbarWidth = getScrollbarWidth();
tryOnBeforeMount(() => {
tryOnMounted(() => {
if (!needsScrollbar()) {
return;
}

1
packages/effects/layouts/package.json

@ -20,6 +20,7 @@
}
},
"dependencies": {
"@vben-core/composables": "workspace:*",
"@vben-core/form-ui": "workspace:*",
"@vben-core/layout-ui": "workspace:*",
"@vben-core/menu-ui": "workspace:*",

3
packages/effects/layouts/src/widgets/lock-screen/lock-screen.vue

@ -4,6 +4,7 @@ import { computed, reactive, ref } from 'vue';
import { LockKeyhole } from '@vben/icons';
import { $t, useI18n } from '@vben/locales';
import { storeToRefs, useLockStore } from '@vben/stores';
import { useScrollLock } from '@vben-core/composables';
import { useVbenForm, z } from '@vben-core/form-ui';
import { VbenAvatar, VbenButton } from '@vben-core/shadcn-ui';
@ -74,6 +75,8 @@ async function handleSubmit() {
function toggleUnlockForm() {
showUnlockForm.value = !showUnlockForm.value;
}
useScrollLock();
</script>
<template>

3
pnpm-lock.yaml

@ -1524,6 +1524,9 @@ importers:
packages/effects/layouts:
dependencies:
'@vben-core/composables':
specifier: workspace:*
version: link:../../@core/composables
'@vben-core/form-ui':
specifier: workspace:*
version: link:../../@core/ui-kit/form-ui

Loading…
Cancel
Save