load-more.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="container">
  3. <uni-card is-full :is-shadow="false">
  4. <text class="uni-h6">加载更多组件用于页面加载更多数据时,页面底部显示内容等场景</text>
  5. </uni-card>
  6. <uni-section title="基本用法" type="line">
  7. <uni-load-more :status="status" />
  8. </uni-section>
  9. <uni-section title="修改默认文字" type="line">
  10. <uni-load-more :status="status" :content-text="contentText" />
  11. </uni-section>
  12. <uni-section title="改变颜色" type="line">
  13. <uni-load-more color="#007AFF" :status="status" />
  14. </uni-section>
  15. <uni-section title="指定加载图标样式 - 按平台自动选择样式" type="line">
  16. <uni-load-more iconType="auto" :status="status" />
  17. </uni-section>
  18. <uni-section title="指定加载图标样式 - 环形" type="line">
  19. <uni-load-more iconType="circle" :status="status" />
  20. </uni-section>
  21. <uni-section title="改变组件状态" type="line">
  22. <radio-group class="uni-list" @change="onChange">
  23. <view v-for="(item, index) in statusTypes" :key="index" class="uni-list-item">
  24. <view class="uni-list-item__container">
  25. <view class="uni-list-item__content">
  26. <text class="uni-list-item__content-title">{{ item.text }}</text>
  27. </view>
  28. <view class="uni-list-item__extra">
  29. <radio :value="item.value" :checked="item.checked" />
  30. </view>
  31. </view>
  32. </view>
  33. </radio-group>
  34. </uni-section>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. components: {},
  40. data() {
  41. return {
  42. status: 'more',
  43. statusTypes: [{
  44. value: 'more',
  45. text: '加载前',
  46. checked: true
  47. }, {
  48. value: 'loading',
  49. text: '加载中',
  50. checked: false
  51. }, {
  52. value: 'noMore',
  53. text: '没有更多',
  54. checked: false
  55. }],
  56. contentText: {
  57. contentdown: '查看更多',
  58. contentrefresh: '加载中',
  59. contentnomore: '没有更多'
  60. }
  61. }
  62. },
  63. methods: {
  64. onChange(e) {
  65. this.status = e.detail.value
  66. },
  67. clickLoadMore(e) {
  68. uni.showToast({
  69. icon: 'none',
  70. title: "当前状态:" + e.detail.status
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .uni-list-item {
  78. border-bottom-style: solid;
  79. border-bottom-width: 1px;
  80. border-bottom-color: #eee;
  81. font-size: 14px;
  82. }
  83. .uni-list-item__container {
  84. /* #ifndef APP-NVUE */
  85. display: flex;
  86. width: 100%;
  87. box-sizing: border-box;
  88. /* #endif */
  89. padding: 12px 15px;
  90. flex: 1;
  91. position: relative;
  92. flex-direction: row;
  93. justify-content: space-between;
  94. align-items: center;
  95. }
  96. .uni-list-item__content-title {
  97. font-size: 14px;
  98. color: #666;
  99. }
  100. </style>