zj-fiex-row.vue 2.7 KB

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