zj-fiex-column.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view
  3. :class="{
  4. 'zj-page-container': true,
  5. 'zj-page-container-column': direction === 'column'
  6. }"
  7. :style="{
  8. width,
  9. height,
  10. background
  11. }"
  12. >
  13. <slot name="before"></slot>
  14. <view :class="['zj-page-fill', zjPageFillClass]">
  15. <view class="zj-page-fill-absolute">
  16. <template v-if="scroll">
  17. <scroll-view
  18. class="zj-page-fill-scroll"
  19. scroll-y
  20. enable-flex
  21. @scrolltoupper="
  22. (...p) => {
  23. $emit('scrolltoupper', p)
  24. }
  25. "
  26. @scrolltolower="
  27. (...p) => {
  28. $emit('scrolltolower', p)
  29. }
  30. "
  31. @scroll="
  32. (...p) => {
  33. $emit('scroll', p)
  34. }
  35. "
  36. @refresherpulling="
  37. (...p) => {
  38. $emit('refresherpulling', p)
  39. }
  40. "
  41. @refresherrefresh="
  42. (...p) => {
  43. $emit('refresherrefresh', p)
  44. }
  45. "
  46. @refresherrestore="
  47. (...p) => {
  48. $emit('refresherrestore', p)
  49. }
  50. "
  51. @refresherabort="
  52. (...p) => {
  53. $emit('refresherabort', p)
  54. }
  55. "
  56. :refresher-enabled="refresherEnabled"
  57. :refresher-triggered="refresherTriggered"
  58. >
  59. <slot></slot>
  60. </scroll-view>
  61. </template>
  62. <template v-else>
  63. <slot></slot>
  64. </template>
  65. </view>
  66. </view>
  67. <slot name="after"></slot>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. props: {
  73. background: {
  74. type: String,
  75. default: ''
  76. },
  77. width: {
  78. type: String,
  79. default: '100%'
  80. },
  81. height: {
  82. type: String,
  83. default: '100%'
  84. },
  85. direction: {
  86. type: String,
  87. default: 'column'
  88. },
  89. scroll: {
  90. type: Boolean,
  91. default: true
  92. },
  93. zjPageFillClass: {
  94. type: String,
  95. default: ''
  96. },
  97. refresherEnabled: {
  98. type: Boolean,
  99. default: false
  100. },
  101. refresherTriggered: {
  102. type: Boolean,
  103. default: false
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .zj-page-container {
  110. display: flex;
  111. display: -webkit-flex;
  112. box-sizing: border-box;
  113. }
  114. .zj-page-container-row {
  115. flex-direction: row;
  116. }
  117. .zj-page-container-column {
  118. flex-direction: column;
  119. }
  120. .zj-page-fill {
  121. box-sizing: border-box;
  122. flex: 1;
  123. overflow: hidden;
  124. position: relative;
  125. .zj-page-fill-absolute {
  126. position: absolute;
  127. top: 0;
  128. right: 0;
  129. bottom: 0;
  130. left: 0;
  131. }
  132. .zj-page-fill-scroll {
  133. width: 100%;
  134. height: 100%;
  135. box-sizing: border-box;
  136. }
  137. }
  138. </style>