zj-page-fill.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view :class="['zj-page-fill', zjPageFillClass]">
  3. <view class="zj-page-fill-absolute">
  4. <template v-if="scroll">
  5. <!-- v-bind="scrollAttribute" -->
  6. <scroll-view class="zj-page-fill-scroll" scroll-y enable-flex @scrolltoupper="
  7. (...p) => {
  8. $emit('scrolltoupper', p)
  9. }
  10. " @scrolltolower="
  11. (...p) => {
  12. $emit('scrolltolower', p)
  13. }
  14. " @scroll="
  15. (...p) => {
  16. $emit('scroll', p)
  17. }
  18. " @refresherpulling="
  19. (...p) => {
  20. $emit('refresherpulling', p)
  21. }
  22. " @refresherrefresh="
  23. (...p) => {
  24. $emit('refresherrefresh', p)
  25. }
  26. " @refresherrestore="
  27. (...p) => {
  28. $emit('refresherrestore', p)
  29. }
  30. " @refresherabort="
  31. (...p) => {
  32. $emit('refresherabort', p)
  33. }
  34. ">
  35. <slot></slot>
  36. </scroll-view>
  37. </template>
  38. <template v-else>
  39. <slot></slot>
  40. </template>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. name: 'ZjPageFill',
  47. props: {
  48. scroll: {
  49. type: Boolean,
  50. default: true
  51. },
  52. scrollAttribute: {
  53. type: Object,
  54. default: () => ({})
  55. },
  56. zjPageFillClass: {
  57. type: String,
  58. default: ''
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .zj-page-fill {
  65. flex: 1;
  66. overflow: hidden;
  67. position: relative;
  68. height: 100%;
  69. .zj-page-fill-absolute {
  70. position: absolute;
  71. top: 0;
  72. right: 0;
  73. bottom: 0;
  74. left: 0;
  75. }
  76. .zj-page-fill-scroll {
  77. width: 100%;
  78. height: 100%;
  79. box-sizing: border-box;
  80. }
  81. }
  82. </style>