feat: 兼容在app上页面滚动与键盘问题
This commit is contained in:
@@ -9,7 +9,14 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<scroll-view class="flex-full border-box min-height-0" scroll-y show-scrollbar="false">
|
||||
<scroll-view
|
||||
class="discovery-scroll flex-full border-box min-height-0"
|
||||
scroll-y
|
||||
show-scrollbar="false"
|
||||
@touchstart="emitScrollTouchStart"
|
||||
@touchmove="emitScrollTouch"
|
||||
@scroll="emitScrollTouch"
|
||||
>
|
||||
<CardSwiper v-if="discoveryCards.length > 0" :list="discoveryCards" @didSelectItem="handleCardClick" />
|
||||
|
||||
<QuickQuestions v-if="discoveryQuickQuestions.length > 0" :list="discoveryQuickQuestions" @didSelectItem="handleQuickQuestionClick" />
|
||||
@@ -42,6 +49,15 @@ const activeIndex = ref(0);
|
||||
const discoveryTabs = ref([]);
|
||||
const discoveryCards = ref([]);
|
||||
const discoveryQuickQuestions = ref([]);
|
||||
const emit = defineEmits(["scroll-touch-start", "scroll-touch"]);
|
||||
|
||||
const emitScrollTouchStart = () => {
|
||||
emit("scroll-touch-start");
|
||||
};
|
||||
|
||||
const emitScrollTouch = () => {
|
||||
emit("scroll-touch");
|
||||
};
|
||||
|
||||
/// tabs 切换事件
|
||||
const handleTabChange = ({ tab, idx }) => {
|
||||
@@ -188,5 +204,10 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.discovery-scroll {
|
||||
flex-basis: 0;
|
||||
height: 0;
|
||||
min-height: 0;
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user