From 5aa8c63d009aa21921c7c13a8a60c21ef42238ee Mon Sep 17 00:00:00 2001 From: sight <1453017105@qq.com> Date: Wed, 22 Jun 2022 15:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(component):=20[dropdown]=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E9=9D=A2=E6=9D=BF=E5=A4=A7=E5=B0=8F=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=97=B6=E8=87=AA=E9=80=82=E5=BA=94=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/component/src/component/dropdown/index.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/package/component/src/component/dropdown/index.vue b/package/component/src/component/dropdown/index.vue index 9b001704..722cb6f8 100644 --- a/package/component/src/component/dropdown/index.vue +++ b/package/component/src/component/dropdown/index.vue @@ -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 });