chore: rename composables folder

This commit is contained in:
chenjiahan
2020-11-16 11:41:46 +08:00
parent dc6330bcdc
commit 062cd546a9
60 changed files with 67 additions and 67 deletions
+25
View File
@@ -0,0 +1,25 @@
let count = 0;
const CLASSNAME = 'van-overflow-hidden';
export function useLockScroll(shouldLock: () => boolean) {
const lock = () => {
if (shouldLock()) {
if (!count) {
document.body.classList.add(CLASSNAME);
}
count++;
}
};
const unlock = () => {
if (shouldLock() && count) {
count--;
if (!count) {
document.body.classList.remove(CLASSNAME);
}
}
};
return [lock, unlock];
}