ui-empty.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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: 100
  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. &__text {
  48. font-size: 32rpx;
  49. margin-top: 10rpx;
  50. color: #999;
  51. }
  52. &__wrap {
  53. flex-direction: column;
  54. color: #999;
  55. font-size: 26rpx;
  56. margin-top: 10rpx;
  57. }
  58. }
  59. .empty-icon {
  60. width: 260rpx;
  61. height: 260rpx;
  62. }
  63. .select-btn {
  64. margin-top: 50rpx;
  65. color: $color-primary;
  66. font-size: 26rpx;
  67. border-radius: 50rpx;
  68. border-color: $color-primary;
  69. }
  70. </style>