feat(square): differentiate scroll behavior for xinghe/xingbang/guangchang tabs
This commit is contained in:
parent
71ee3795b9
commit
751bd68bf1
@ -45,7 +45,7 @@
|
|||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<scroll-view
|
<scroll-view
|
||||||
class="content-wrapper"
|
class="content-wrapper"
|
||||||
scroll-y
|
:scroll-y="activeContentTab === 'guangchang'"
|
||||||
:show-scrollbar="false"
|
:show-scrollbar="false"
|
||||||
:bounce="false"
|
:bounce="false"
|
||||||
@scroll="onScroll"
|
@scroll="onScroll"
|
||||||
@ -92,7 +92,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
import { ref, watch, onMounted, onUnmounted } from "vue";
|
||||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
import Header from "../components/Header.vue";
|
import Header from "../components/Header.vue";
|
||||||
@ -121,6 +121,12 @@ const creationGridRef = ref(null);
|
|||||||
const cardTapTimers = {};
|
const cardTapTimers = {};
|
||||||
const likingMap = ref({});
|
const likingMap = ref({});
|
||||||
|
|
||||||
|
// 切 tab 时重置外层 scroll-view 的 scrollTop,避免残留滚动位置
|
||||||
|
watch(activeContentTab, () => {
|
||||||
|
// 星河/星榜 时 scroll-y=false,但 scrollTop 残留可能导致显示异常
|
||||||
|
uni.pageScrollTo({ scrollTop: 0, duration: 0 });
|
||||||
|
});
|
||||||
|
|
||||||
// 统一 scroll 处理:驱动 CreationGrid 切 fixed
|
// 统一 scroll 处理:驱动 CreationGrid 切 fixed
|
||||||
const onScroll = (e) => {
|
const onScroll = (e) => {
|
||||||
const scrollTop = (e && e.detail && e.detail.scrollTop) || 0;
|
const scrollTop = (e && e.detail && e.detail.scrollTop) || 0;
|
||||||
@ -348,7 +354,8 @@ onUnmounted(() => {
|
|||||||
/* 热门分类区块 */
|
/* 热门分类区块 */
|
||||||
.hot-category-wrapper {
|
.hot-category-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-bottom: 80rpx;
|
/* 100vh - header(208rpx) - banner(360rpx) - tabs(88rpx) = 可用 body 高度 */
|
||||||
|
height: calc(100vh - 208rpx - 360rpx - 88rpx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 蒙层 */
|
/* 蒙层 */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user