cl-loadmore.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="cl-loadmore__wrap">
  3. <cl-divider :background-color="backgroundColor" :color="color" :width="divider ? '400rpx' : '0rpx'">
  4. <view class="cl-loadmore">
  5. <cl-loading :color="iconColor" :theme="loadingTheme" :size="20" v-if="!finish && loading"></cl-loading>
  6. <text class="cl-loadmore__text" :style="{
  7. color,
  8. }" v-if="message">{{ message }}</text>
  9. </view>
  10. </cl-divider>
  11. </view>
  12. </template>
  13. <script>
  14. /**
  15. * loadmore 加载更多
  16. * @description 加载更多
  17. * @tutorial https://docs.cool-js.com/uni/components/operate/loadmore.html
  18. * @property {Object} loading 是否加载中
  19. * @property {Boolean} finish 是否加载完成
  20. * @property {Boolean} divider 是否显示分割符,默认true
  21. * @property {String} color 字体颜色,默认#666
  22. * @property {String} iconColor 图标颜色
  23. * @property {String} backgroundColor 背景颜色,默认#f7f7f7
  24. * @property {String} text 普通状态下显示内容,默认“上拉加载更多”
  25. * @property {String} loadingText 加载中显示内容,默认“加载中”
  26. * @property {String} loadingTheme 加载图标主题
  27. * @property {String} finishText 加载完成显示内容,默认“没有更多了”
  28. * @example <cl-loadmore :loading="true" />
  29. */
  30. export default {
  31. name: "cl-loadmore",
  32. props: {
  33. // 是否加载中
  34. loading: Boolean,
  35. // 是否加载完成
  36. finish: Boolean,
  37. // 是否显示分割符
  38. divider: {
  39. type: Boolean,
  40. default: true,
  41. },
  42. // 字体颜色
  43. color: {
  44. type: String,
  45. default: "#666",
  46. },
  47. // 图标颜色
  48. iconColor: String,
  49. // 背景颜色
  50. backgroundColor: {
  51. type: String,
  52. default: "#f7f7f7",
  53. },
  54. // 普通状态下显示内容
  55. text: {
  56. type: String,
  57. default: "上拉加载更多",
  58. },
  59. // 加载中显示内容
  60. loadingText: {
  61. type: String,
  62. default: "加载中",
  63. },
  64. // 加载图标主题
  65. loadingTheme: String,
  66. // 加载完成显示内容
  67. finishText: {
  68. type: String,
  69. default: "没有更多了!!!!!!!!!!!!!!",
  70. },
  71. },
  72. computed: {
  73. message() {
  74. return this.finish ? this.finishText : this.loading ? this.loadingText : this.text;
  75. },
  76. },
  77. };
  78. </script>