@scalar/api-client
Version:
the open source API testing client
22 lines (21 loc) • 547 B
JavaScript
import { ref as s, computed as f, onBeforeUnmount as a, toValue as n } from "vue";
const v = (l) => {
const o = s(""), t = s(!1), c = () => {
const e = n(l);
e && (o.value = e.style.overflow, e.style.overflow = "hidden");
}, r = () => {
const e = n(l);
e && (o.value !== "" ? e.style.overflow = o.value : e.style.removeProperty("overflow"));
}, u = f({
get: () => t.value,
set: (e) => {
t.value = e, e ? c() : r();
}
});
return a(() => {
t.value && r();
}), u;
};
export {
v as useScrollLock
};