From ad19345db6c20e3688a26d4ef0c9f5ce0e66b66a Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:00:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(x-popup):=20=E5=A2=9E=E5=8A=A0=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=86=85=E5=88=97=E8=A1=A8=E8=87=AA=E5=8A=A8=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E5=8A=9F=E8=83=BD-=20=E5=9C=A8=20x-popup=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E6=B7=BB=E5=8A=A0=20list-container=20?= =?UTF-8?q?=E7=B1=BB=E5=90=8D=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=90=8E=E7=BB=AD?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E6=93=8D=E4=BD=9C=20-=20=E5=9C=A8=20tangPopu?= =?UTF-8?q?p.vue=20=E4=B8=AD=E5=AE=9E=E7=8E=B0=20scrollToCurrentItem=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E5=88=B0=E5=BD=93=E5=89=8D=E9=80=89=E4=B8=AD=E7=9A=84=E7=89=A9?= =?UTF-8?q?=E5=93=81=20-=20=E7=9B=91=E5=90=AC=E5=BC=B9=E7=AA=97=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=8A=B6=E6=80=81=EF=BC=8C=E5=BD=93=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=B6=E8=B0=83=E7=94=A8=20scrollToCurrent?= =?UTF-8?q?Item=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/x-popup/index.vue | 2 +- .../components/SideButton/tangPopup.vue | 32 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/components/x-popup/index.vue b/app/components/x-popup/index.vue index 99553a0..16c8e9c 100644 --- a/app/components/x-popup/index.vue +++ b/app/components/x-popup/index.vue @@ -44,7 +44,7 @@ const close=()=>{
-
+
diff --git a/app/pages/liveRoom/components/SideButton/tangPopup.vue b/app/pages/liveRoom/components/SideButton/tangPopup.vue index 5243fa8..bc0c4ce 100644 --- a/app/pages/liveRoom/components/SideButton/tangPopup.vue +++ b/app/pages/liveRoom/components/SideButton/tangPopup.vue @@ -31,6 +31,28 @@ const props = defineProps({ default: '' } }) +const scrollToCurrentItem = () => { + if (!itemList.value?.length) return + + setTimeout(() => { + const currentIndex = itemList.value.findIndex( + item => auctionData.value.artwork.index === item?.index + ) + if (currentIndex > -1) { + const container = document.querySelector('.list-container') + const targetElement = document.querySelectorAll('.item-wrapper')[currentIndex] + if (targetElement && container) { + const containerTop = container.getBoundingClientRect().top + const elementTop = targetElement.getBoundingClientRect().top + const scrollTop = elementTop - containerTop + container.scrollTop + container.scrollTo({ + top: scrollTop, + behavior: 'smooth' + }) + } + } + }, 100) +} const emit = defineEmits(['update:show']) const showDetailInfo=ref(null) const close = () => emit('update:show', false); @@ -44,6 +66,13 @@ const loadMore = async () => { const { finished } = await getArtworkList() localState.value.finished = finished } +watch(()=>props.show,(newValue)=>{ + if (newValue){ + nextTick(()=>{ + scrollToCurrentItem() + }) + } +})