ui-empty.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <!-- 全局 空提示 -->
  3. <view class="ui-empty center" :style="{marginTop:top+'px'}" v-if="show">
  4. <image src="@/static/empty/content.png" class="empty-icon" mode="widthFix"></image>
  5. <text class="center ui-empty__text">{{text}}</text>
  6. <view class="center ui-empty__wrap" v-if="$slots.default || $slots.$default">
  7. <slot />
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. /**
  13. * empty 内容为空
  14. */
  15. export default {
  16. name: "ui-empty",
  17. data() {
  18. return {
  19. }
  20. },
  21. props: {
  22. text: {
  23. type: String,
  24. default: '暂无内容'
  25. },
  26. // 顶部距离
  27. top: {
  28. type: Number,
  29. default: 10
  30. },
  31. // 是否显示组件
  32. show: {
  33. type: Boolean,
  34. default: true
  35. },
  36. },
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .center {
  41. display: flex;
  42. justify-content: center;
  43. align-items: center;
  44. }
  45. .ui-empty {
  46. flex-direction: column;
  47. padding-bottom: 100rpx;
  48. &__text {
  49. font-size: 32rpx;
  50. margin-top: 10rpx;
  51. color: #999;
  52. }
  53. &__wrap {
  54. flex-direction: column;
  55. color: #999;
  56. font-size: 26rpx;
  57. margin-top: 10rpx;
  58. }
  59. }
  60. .empty-icon {
  61. width: 260rpx;
  62. height: 260rpx;
  63. }
  64. .select-btn {
  65. margin-top: 50rpx;
  66. color: $color-primary;
  67. font-size: 26rpx;
  68. border-radius: 50rpx;
  69. border-color: $color-primary;
  70. }
  71. </style>