fix(square): use ref-binding for scrollTop reset; add bottom safety margin

This commit is contained in:
zheng020 2026-06-11 12:43:09 +08:00
parent 751bd68bf1
commit b0290456bb
2 changed files with 105 additions and 79 deletions

View File

@ -24,6 +24,13 @@
</view> </view>
</view> </view>
<!-- 内容区域: 内部 scroll -->
<scroll-view
class="content-scroll"
scroll-y
:show-scrollbar="false"
:bounce="false"
>
<!-- 骨架屏 --> <!-- 骨架屏 -->
<view v-if="loading" class="grid-skeleton"> <view v-if="loading" class="grid-skeleton">
<view v-for="i in 11" :key="i" class="skeleton-card"> <view v-for="i in 11" :key="i" class="skeleton-card">
@ -114,6 +121,7 @@
</view> </view>
</view> </view>
</view> </view>
</scroll-view>
</view> </view>
</template> </template>
@ -305,11 +313,21 @@ onUnmounted(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.hot-category-block { .hot-category-block {
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 0 9.5rpx; padding: 0 9.5rpx;
border-radius: 24rpx; border-radius: 24rpx;
position: relative; position: relative;
} }
.content-scroll {
flex: 1;
min-height: 0; /* flex 子项需要 min-height: 0 才能正确伸缩 */
overflow: hidden;
}
/* Tab 栏 —— 与 Figma Rectangle 90 (83:268) 一一对应 */ /* Tab 栏 —— 与 Figma Rectangle 90 (83:268) 一一对应 */
.ranking-tabs { .ranking-tabs {
display: flex; display: flex;
@ -480,7 +498,11 @@ onUnmounted(() => {
border-bottom-right-radius: 12px; border-bottom-right-radius: 12px;
border-bottom-left-radius: 12px; border-bottom-left-radius: 12px;
opacity: 0.8; /* 与 Figma 一致 */ opacity: 0.8; /* 与 Figma 一致 */
padding: 40rpx 20rpx 0; /* padding: 40rpx 20rpx 0; */
/* 80rpx Task 2 .hot-category-wrapper height ,
重新加上 32rpx 底部 padding 保证最后一行卡片不会紧贴 scroll-view 底边
避免与 BottomNav fixed 区域视觉重叠 */
padding: 40rpx 20rpx 32rpx;
overflow: hidden; overflow: hidden;
} }

View File

@ -46,6 +46,7 @@
<scroll-view <scroll-view
class="content-wrapper" class="content-wrapper"
:scroll-y="activeContentTab === 'guangchang'" :scroll-y="activeContentTab === 'guangchang'"
:scroll-top="outerScrollTop"
:show-scrollbar="false" :show-scrollbar="false"
:bounce="false" :bounce="false"
@scroll="onScroll" @scroll="onScroll"
@ -120,11 +121,14 @@ const showRankingModal = ref(false);
const creationGridRef = ref(null); const creationGridRef = ref(null);
const cardTapTimers = {}; const cardTapTimers = {};
const likingMap = ref({}); const likingMap = ref({});
// scroll-view scrollTop ref
// uni.pageScrollTo page <scroll-view>
const outerScrollTop = ref(0);
// tab scroll-view scrollTop, // tab scroll-view scrollTop,
watch(activeContentTab, () => { watch(activeContentTab, () => {
// / scroll-y=false, scrollTop // / scroll-y=false, scrollTop
uni.pageScrollTo({ scrollTop: 0, duration: 0 }); outerScrollTop.value = 0;
}); });
// scroll CreationGrid fixed // scroll CreationGrid fixed