load-more.nvue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view>
  3. <text class="example-info">加载更多组件用于页面加载更多数据时,页面底部显示内容等场景。</text>
  4. <uni-section title="基本用法" type="line"></uni-section>
  5. <view class="example-body">
  6. <uni-load-more :status="status" />
  7. </view>
  8. <uni-section title="修改默认文字" type="line"></uni-section>
  9. <view class="example-body">
  10. <uni-load-more :status="status" :content-text="contentText" />
  11. </view>
  12. <uni-section title="改变颜色" type="line"></uni-section>
  13. <view class="example-body">
  14. <uni-load-more color="#007AFF" :status="status" />
  15. </view>
  16. <!-- #ifndef APP-NVUE -->
  17. <uni-section title="指定加载图标样式 - 按平台自动选择样式" type="line"></uni-section>
  18. <view class="example-body">
  19. <uni-load-more iconType="auto" :status="status" />
  20. </view>
  21. <uni-section title="指定加载图标样式 - 环形" type="line"></uni-section>
  22. <view class="example-body">
  23. <uni-load-more iconType="circle" :status="status" />
  24. </view>
  25. <uni-section title="指定加载图标样式 - 雪花" type="line"></uni-section>
  26. <view class="example-body">
  27. <uni-load-more iconType="snow" :status="status" />
  28. </view>
  29. <!-- #endif -->
  30. <uni-section title="指定加载图标大小" type="line"></uni-section>
  31. <view class="example-body">
  32. <uni-load-more iconType="snow" :iconSize="36" :status="status" />
  33. </view>
  34. <uni-section title="点击事件" type="line"></uni-section>
  35. <view class="example-body">
  36. <uni-load-more :status="status" @clickLoadMore="clickLoadMore" />
  37. </view>
  38. <uni-section title="改变组件状态" type="line"></uni-section>
  39. <radio-group class="uni-list" @change="onChange">
  40. <view v-for="(item, index) in statusTypes" :key="index" class="uni-list-item">
  41. <view class="uni-list-item__container">
  42. <view class="uni-list-item__content">
  43. <text class="uni-list-item__content-title">{{ item.text }}</text>
  44. </view>
  45. <view class="uni-list-item__extra">
  46. <radio :value="item.value" :checked="item.checked" />
  47. </view>
  48. </view>
  49. </view>
  50. </radio-group>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. components: {},
  56. data() {
  57. return {
  58. status: 'more',
  59. statusTypes: [{
  60. value: 'more',
  61. text: '加载前',
  62. checked: true
  63. }, {
  64. value: 'loading',
  65. text: '加载中',
  66. checked: false
  67. }, {
  68. value: 'noMore',
  69. text: '没有更多',
  70. checked: false
  71. }],
  72. contentText: {
  73. contentdown: '查看更多',
  74. contentrefresh: '加载中',
  75. contentnomore: '没有更多'
  76. }
  77. }
  78. },
  79. methods: {
  80. onChange(e) {
  81. this.status = e.detail.value
  82. },
  83. clickLoadMore(e) {
  84. uni.showToast({
  85. icon: 'none',
  86. title: "当前状态:" + e.detail.status
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style>
  93. @charset "UTF-8";
  94. /* 头条小程序组件内不能引入字体 */
  95. /* #ifdef MP-TOUTIAO */
  96. @font-face {
  97. font-family: uniicons;
  98. font-weight: normal;
  99. font-style: normal;
  100. src: url("~@/static/uni.ttf") format("truetype");
  101. }
  102. /* #endif */
  103. /* #ifndef APP-NVUE */
  104. page {
  105. display: flex;
  106. flex-direction: column;
  107. box-sizing: border-box;
  108. background-color: #efeff4;
  109. min-height: 100%;
  110. height: auto;
  111. }
  112. view {
  113. font-size: 14px;
  114. line-height: inherit;
  115. }
  116. .example {
  117. padding: 0 15px 15px;
  118. }
  119. .example-info {
  120. padding: 15px;
  121. color: #3b4144;
  122. background: #ffffff;
  123. }
  124. .example-body {
  125. /* #ifndef APP-NVUE */
  126. display: flex;
  127. /* #endif */
  128. flex-direction: row;
  129. flex-wrap: wrap;
  130. justify-content: center;
  131. padding: 0;
  132. font-size: 14px;
  133. background-color: #ffffff;
  134. }
  135. /* #endif */
  136. .example {
  137. padding: 0 15px;
  138. }
  139. .example-info {
  140. /* #ifndef APP-NVUE */
  141. display: block;
  142. /* #endif */
  143. padding: 15px;
  144. color: #3b4144;
  145. background-color: #ffffff;
  146. font-size: 14px;
  147. line-height: 20px;
  148. }
  149. .example-info-text {
  150. font-size: 14px;
  151. line-height: 20px;
  152. color: #3b4144;
  153. }
  154. .example-body {
  155. flex-direction: column;
  156. padding: 15px;
  157. background-color: #ffffff;
  158. }
  159. .word-btn-white {
  160. font-size: 18px;
  161. color: #FFFFFF;
  162. }
  163. .word-btn {
  164. /* #ifndef APP-NVUE */
  165. display: flex;
  166. /* #endif */
  167. flex-direction: row;
  168. align-items: center;
  169. justify-content: center;
  170. border-radius: 6px;
  171. height: 48px;
  172. margin: 15px;
  173. background-color: #007AFF;
  174. }
  175. .word-btn--hover {
  176. background-color: #4ca2ff;
  177. }
  178. .uni-list {
  179. background-color: #fff;
  180. }
  181. .example-body {
  182. padding: 6px 15px;
  183. /* #ifndef APP-NVUE */
  184. display: block;
  185. /* #endif */
  186. }
  187. .uni-list-item {
  188. border-bottom-style: solid;
  189. border-bottom-width: 1px;
  190. border-bottom-color: #e5e5e5;
  191. }
  192. .uni-list-item__container {
  193. /* #ifndef APP-NVUE */
  194. display: flex;
  195. width: 100%;
  196. box-sizing: border-box;
  197. /* #endif */
  198. padding: 12px 15px;
  199. flex: 1;
  200. position: relative;
  201. flex-direction: row;
  202. justify-content: space-between;
  203. align-items: center;
  204. }
  205. .uni-list-item__content-title {
  206. font-size: 16px;
  207. }
  208. </style>