no-data.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view>
  3. <!-- 1 加载中 -->
  4. <view v-if="propStatus == 1" class="no-data-box no-data-loading">
  5. <text>加载中...</text>
  6. </view>
  7. <!-- 2 处理错误 -->
  8. <view v-else-if="propStatus == 2" class="no-data-box">
  9. <image :src="static_dir+'error.png'" mode="widthFix"></image>
  10. <view class="no-data-tips">{{propMsg || '处理错误'}}</view>
  11. </view>
  12. <!-- 0 默认没有数据 -->
  13. <view v-else-if="propStatus == 0" class="no-data-box">
  14. <image :src="static_dir+'empty.png'" mode="widthFix"></image>
  15. <view class="no-data-tips">{{propMsg || '没有相关数据'}}</view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. const app = getApp();
  21. export default {
  22. data() {
  23. return {
  24. static_dir: '/static/images/common/',
  25. };
  26. },
  27. components: {},
  28. props: {
  29. propStatus: {
  30. type: [Number,String],
  31. default: 0
  32. },
  33. propMsg: {
  34. type: String,
  35. default: '没有相关数据'
  36. }
  37. },
  38. methods: {}
  39. };
  40. </script>
  41. <style>
  42. .no-data-box {
  43. padding: 10% 0;
  44. text-align: center;
  45. }
  46. .no-data-box image {
  47. width: 160rpx;
  48. margin-bottom: 30rpx;
  49. }
  50. .no-data-box .no-data-tips {
  51. font-size: 28rpx;
  52. color: #a6a6a6;
  53. }
  54. .no-data-loading text {
  55. color: #999;
  56. }
  57. </style>