zhengyiming
3 天以前 9453bef1fc4a3121b28ffa6617f0fbfc81d9f634
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
  <scroll-view
    class="content-scroll-view-wrapper"
    :class="{ hasPaddingTop, isNoWeb: !isWeb || showBgColor }"
    :scroll-y="true"
  >
    <ContentView
      :class="['content-scroll-view-wrapper-inner', props.allHeight ? 'all-height' : '']"
      :paddingH="paddingH"
    >
      <slot />
    </ContentView>
  </scroll-view>
</template>
 
<script setup lang="ts">
import ContentView from './ContentView.vue';
import { isWeb } from '@/utils/env';
 
defineOptions({
  name: 'ContentScrollView',
});
 
type Props = {
  hasPaddingTop?: boolean;
  allHeight?: boolean;
  paddingH?: boolean;
  showBgColor?: boolean;
};
 
const props = withDefaults(defineProps<Props>(), {
  hasPaddingTop: false,
  allHeight: false,
  paddingH: true,
  showBgColor: true,
});
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.content-scroll-view-wrapper {
  @include listScrollViewWithNoPadding;
 
  &.isNoWeb {
    background-color: $body-background-color;
  }
 
  &.hasPaddingTop {
    padding-top: 32px;
  }
 
  .content-scroll-view-wrapper-inner {
    @include ScrollViewInner;
 
    &.all-height {
      height: 100%;
      padding-bottom: 0;
      display: flex;
      flex-direction: column;
    }
  }
}
</style>