index.vue 890 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="empty-view">
  3. <image
  4. :style="emptyImgStyle"
  5. :src="require(`@/static/images/com/${imageName}.png`)"
  6. ></image>
  7. <text class="empty-txt">{{ placeholder }}</text>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: 'statusView',
  13. props: {
  14. imageName: {
  15. default: 'empty',
  16. type: String,
  17. },
  18. emptyImgStyle: {
  19. type: Object,
  20. default: () => ({
  21. width: '207px',
  22. height: '207px',
  23. }),
  24. },
  25. },
  26. computed: {
  27. placeholder() {
  28. const types = {
  29. empty: '暂无数据',
  30. 'load-fail': '数据加载失败,请下拉刷新',
  31. };
  32. return types[this.imageName];
  33. },
  34. },
  35. };
  36. </script>
  37. <style scoped lang="scss">
  38. .empty-view {
  39. display: flex;
  40. flex-direction: column;
  41. align-items: center;
  42. background-color: #fff;
  43. width: 100%;
  44. padding: 20rpx 0;
  45. .empty-txt {
  46. margin-top: 60rpx;
  47. font-size: 14px;
  48. color: #a7a7a7;
  49. }
  50. }
  51. </style>