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() + }) + } +})