BaseEmpty.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="base-empty" :class="{ 'base-empty--compact': compact }">
  3. <view class="base-empty__icon" v-if="icon || $slots.icon">
  4. <slot name="icon">
  5. <text class="base-empty__emoji">{{ icon }}</text>
  6. </slot>
  7. </view>
  8. <text class="base-empty__title" v-if="title">{{ title }}</text>
  9. <text class="base-empty__description" v-if="description">{{ description }}</text>
  10. <view class="base-empty__action" v-if="$slots.action">
  11. <slot name="action"></slot>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'BaseEmpty',
  18. props: {
  19. icon: { type: String, default: '' },
  20. title: { type: String, default: '' },
  21. description: { type: String, default: '' },
  22. compact: { type: Boolean, default: false }
  23. }
  24. }
  25. </script>
  26. <style scoped>
  27. .base-empty {
  28. display: flex;
  29. flex-direction: column;
  30. align-items: center;
  31. justify-content: center;
  32. padding: 80rpx 32rpx;
  33. min-height: 400rpx;
  34. }
  35. .base-empty--compact {
  36. padding: 48rpx 32rpx;
  37. min-height: auto;
  38. }
  39. .base-empty__icon {
  40. margin-bottom: 24rpx;
  41. }
  42. .base-empty__emoji {
  43. font-size: 80rpx;
  44. display: block;
  45. text-align: center;
  46. }
  47. .base-empty__title {
  48. font-size: 30rpx;
  49. font-weight: 600;
  50. color: var(--text, #3D2E1E);
  51. margin-bottom: 12rpx;
  52. text-align: center;
  53. }
  54. .base-empty__description {
  55. font-size: 26rpx;
  56. color: var(--text-secondary, #6B5A4A);
  57. text-align: center;
  58. line-height: 1.6;
  59. max-width: 500rpx;
  60. }
  61. .base-empty__action {
  62. margin-top: 32rpx;
  63. }
  64. </style>