pub-loading-view.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="pub-loading">
  3. <view v-if="loaded" class="load-view" :style="`height: ${height};width: ${width};`">
  4. <uni-load-more :status="status" :content-text="contentText" :showText="showText" />
  5. </view>
  6. <view v-else>
  7. <slot />
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. components: {},
  14. name: 'PubLoadingView',
  15. computed: {
  16. contentText() {
  17. let _text = {
  18. contentdown: this.text,
  19. contentrefresh: this.text,
  20. contentnomore: '没有更多数据了',
  21. }
  22. return _text;
  23. }
  24. },
  25. props: {
  26. loaded: {
  27. type: Boolean,
  28. default: false
  29. },
  30. status: {
  31. type: String,
  32. default: "loading"
  33. },
  34. text: {
  35. type: String,
  36. default: "数据加载中..."
  37. },
  38. height: {
  39. type: String,
  40. default: "100vh"
  41. },
  42. width: {
  43. type: String,
  44. default: "100%"
  45. },
  46. showText: {
  47. type: Boolean,
  48. default: true
  49. },
  50. },
  51. data() {
  52. return {
  53. }
  54. },
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .pub-loading {
  59. // height: 100%;
  60. .load-view {
  61. width: 100%;
  62. // height: 400rpx;
  63. // display: flex;
  64. // justify-content: center;
  65. // align-items: center;
  66. @include flex-center;
  67. }
  68. .full-height {
  69. height: 100vh;
  70. }
  71. }
  72. </style>