cl-loading-mask.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="cl-loading-mask__wrap">
  3. <view
  4. class="cl-loading-mask"
  5. :class="[classList]"
  6. :style="{
  7. background,
  8. color,
  9. }"
  10. >
  11. <view class="cl-loading-mask__content" v-if="loading">
  12. <cl-loading :color="color" :loading-theme="loadingTheme"></cl-loading>
  13. <text v-if="text" class="cl-loading-mask__text">{{ text }}</text>
  14. </view>
  15. </view>
  16. <slot></slot>
  17. </view>
  18. </template>
  19. <script>
  20. /**
  21. * loading-mask 加载区域
  22. * @description 加载区域
  23. * @tutorial https://docs.cool-js.com/uni/components/feedback/loading.html
  24. * @property {String} text 加载时文本,默认不显示
  25. * @property {Boolean} loading 是否加载中
  26. * @property {String} loadingTheme 加载图标主题
  27. * @property {Boolean} fullscreen 是否全屏显示
  28. * @property {String} color 加载图标颜色
  29. * @property {String} background 背景颜色,默认rgba(255,255,255,0.7)
  30. * @example <cl-loading-mask :loading="true"></cl-loading-mask>
  31. */
  32. export default {
  33. name: "cl-loading-mask",
  34. props: {
  35. text: String,
  36. loading: Boolean,
  37. loadingTheme: String,
  38. fullscreen: Boolean,
  39. color: String,
  40. background: {
  41. type: String,
  42. default: "rgba(255, 255, 255, 0.7)",
  43. },
  44. },
  45. computed: {
  46. classList() {
  47. let list = [];
  48. if (this.fullscreen) {
  49. list.push("cl-loading-mask--fixed");
  50. }
  51. if (this.loading) {
  52. list.push("is-show");
  53. }
  54. return list.join(" ");
  55. },
  56. },
  57. };
  58. </script>