uni-list.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <!-- #ifndef APP-NVUE -->
  3. <view class="uni-list">
  4. <slot />
  5. </view>
  6. <!-- #endif -->
  7. <!-- #ifdef APP-NVUE -->
  8. <list class="uni-list" :enableBackToTop="enableBackToTop" loadmoreoffset="15" :scroll-y="scrollY" @loadmore="loadMore">
  9. <slot />
  10. </list>
  11. <!-- #endif -->
  12. </template>
  13. <script>
  14. export default {
  15. name: 'UniList',
  16. 'mp-weixin': {
  17. options: {
  18. multipleSlots: false
  19. }
  20. },
  21. props: {
  22. enableBackToTop: {
  23. type: [Boolean, String],
  24. default: false
  25. },
  26. scrollY: {
  27. type: [Boolean, String],
  28. default: false
  29. }
  30. },
  31. provide() {
  32. return {
  33. list: this
  34. }
  35. },
  36. created() {
  37. this.firstChildAppend = false
  38. },
  39. methods: {
  40. loadMore(e) {
  41. this.$emit("scrolltolower");
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .uni-list {
  48. /* #ifndef APP-NVUE */
  49. display: flex;
  50. /* #endif */
  51. background-color: $uni-bg-color;
  52. position: relative;
  53. flex-direction: column;
  54. // border-bottom-color: $uni-border-color;
  55. // border-bottom-style: solid;
  56. // border-bottom-width: 1px;
  57. }
  58. /* #ifndef APP-NVUE */
  59. .uni-list:before {
  60. height: 0;
  61. }
  62. .uni-list:after {
  63. height: 0;
  64. }
  65. /* #endif */
  66. </style>