Skip to content

Commit

Permalink
fix(Popup): resolved preventScrollThrough invalid when multiple popups (
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao authored Jul 25, 2023
1 parent 54011eb commit a3fba0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/_common
15 changes: 13 additions & 2 deletions src/popup/popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const { prefix } = config;
const name = `${prefix}-popup`;
const bodyLockClass = `${name}-overflow-hidden`;
let lockTimes = 0;
export default defineComponent({
name,
Expand Down Expand Up @@ -119,11 +120,21 @@ export default defineComponent({
);
const lock = () => {
document.body.classList.add(bodyLockClass);
if (!lockTimes) {
document.body.classList.add(bodyLockClass);
}
lockTimes++;
};
const unlock = () => {
document.body.classList.remove(bodyLockClass);
if (lockTimes) {
lockTimes--;
if (!lockTimes) {
document.body.classList.remove(bodyLockClass);
}
}
};
const shouldLock = computed(() => wrapperVisbile.value && props.preventScrollThrough);
Expand Down

0 comments on commit a3fba0d

Please sign in to comment.