🐛(component): [dropdown]下拉面板大小变化时自适应位置

This commit is contained in:
sight 2022-06-22 15:04:22 +08:00
parent a99cc5a204
commit 5aa8c63d00

View File

@ -9,14 +9,11 @@ import "./index.less";
import {
CSSProperties,
nextTick,
onUpdated,
provide,
ref,
shallowRef,
watch,
watchEffect,
} from "vue";
import { onClickOutside, useResizeObserver, useWindowSize } from "@vueuse/core";
import { onClickOutside, useResizeObserver, useScroll, useWindowSize } from "@vueuse/core";
import { DropdownTrigger, dropdownPlacement } from "./interface";
export interface LayDropdownProps {
@ -232,6 +229,12 @@ const getContentOffset = (
}
};
useResizeObserver(contentRef, () => {
if (openState.value) {
updateContentStyle()
}
})
provide("openState", openState);
defineExpose({ open, hide, toggle });