综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <!-- #ifndef APP-NVUE -->
  3. <view
  4. class="uv-list"
  5. :style="[$uv.addStyle(customStyle)]"
  6. >
  7. <view
  8. v-if="border"
  9. class="uv-list--border-top"
  10. :style="[{ 'background-color': borderColor }]"
  11. ></view>
  12. <slot />
  13. <view
  14. v-if="border"
  15. class="uv-list--border-bottom"
  16. :style="[{ 'background-color': borderColor }]"
  17. ></view>
  18. </view>
  19. <!-- #endif -->
  20. <!-- #ifdef APP-NVUE -->
  21. <list
  22. :bounce="true"
  23. :scrollable="true"
  24. show-scrollbar
  25. :render-reverse="false"
  26. class="uv-list"
  27. :class="{ 'uv-list--border': border }"
  28. :style="[
  29. { 'border-top-color': borderColor, 'border-bottom-color':borderColor },
  30. $uv.addStyle(customStyle)
  31. ]"
  32. :enableBackToTop="false"
  33. :loadmoreoffset="15"
  34. @scroll="scroll"
  35. @loadmore="loadMore">
  36. <slot />
  37. </list>
  38. <!-- #endif -->
  39. </template>
  40. <script>
  41. import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
  42. import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
  43. /**
  44. * List 列表
  45. * @description 列表组件
  46. * @tutorial https://www.uvui.cn/components/list.html
  47. * @property {Boolean} border = [true|false] 是否显示边框
  48. * @property {String} borderColor 边框颜色
  49. * @property {String} direction 排版方向,默认row,列表里面使用其他组件 最好设置成column
  50. */
  51. export default {
  52. name: 'uv-list',
  53. mixins: [mpMixin, mixin],
  54. 'mp-weixin': {
  55. options: {
  56. multipleSlots: false
  57. }
  58. },
  59. props: {
  60. border: {
  61. type: Boolean,
  62. default: false
  63. },
  64. borderColor: {
  65. type: String,
  66. default: '#dadbde'
  67. },
  68. // 排版方向,默认row,列表里面使用其他组件 最好设置成column
  69. direction: {
  70. type: String,
  71. default: 'row'
  72. },
  73. // 内边距
  74. padding: {
  75. type: [String,Number],
  76. default: '20rpx 30rpx'
  77. }
  78. },
  79. created() {
  80. this.firstChildAppend = false;
  81. },
  82. computed: {
  83. parentData() {
  84. return [this.direction,this.padding];
  85. }
  86. },
  87. methods: {
  88. loadMore(e) {
  89. this.$emit('scrolltolower');
  90. },
  91. scroll(e) {
  92. this.$emit('scroll', e);
  93. }
  94. }
  95. };
  96. </script>
  97. <style lang="scss" scoped>
  98. @import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
  99. @import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
  100. .uv-list {
  101. position: relative;
  102. @include flex(column);
  103. background-color: #fff;
  104. }
  105. .uv-list--border {
  106. position: relative;
  107. /* #ifdef APP-NVUE */
  108. border-top-color: $uv-border-color;
  109. border-top-style: solid;
  110. border-top-width: 0.5px;
  111. border-bottom-color: $uv-border-color;
  112. border-bottom-style: solid;
  113. border-bottom-width: 0.5px;
  114. /* #endif */
  115. z-index: -1;
  116. }
  117. /* #ifndef APP-NVUE */
  118. .uv-list--border-top {
  119. position: absolute;
  120. top: 0;
  121. right: 0;
  122. left: 0;
  123. height: 1px;
  124. -webkit-transform: scaleY(0.5);
  125. transform: scaleY(0.5);
  126. background-color: $uv-border-color;
  127. z-index: 1;
  128. }
  129. .uv-list--border-bottom {
  130. position: absolute;
  131. bottom: 0;
  132. right: 0;
  133. left: 0;
  134. height: 1px;
  135. -webkit-transform: scaleY(0.5);
  136. transform: scaleY(0.5);
  137. background-color: $uv-border-color;
  138. }
  139. /* #endif */
  140. </style>