fix(Popup): lockScroll not work #7738

This commit is contained in:
chenjiahan
2020-12-27 21:13:07 +08:00
parent 82acfb2f6e
commit c114a0ef47
6 changed files with 78 additions and 18 deletions
@@ -28,12 +28,15 @@ export function getScrollParent(el: Element, root: ScrollElement = window) {
return root;
}
export function useScrollParent(el: Ref<Element | undefined>) {
export function useScrollParent(
el: Ref<Element | undefined>,
root: ScrollElement = window
) {
const scrollParent = ref<Element | Window>();
onMounted(() => {
if (el.value) {
scrollParent.value = getScrollParent(el.value);
scrollParent.value = getScrollParent(el.value, root);
}
});