ui-empty.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <!-- 全局 空提示 -->
  3. <view class="ui-empty center" :style="{marginTop:top+'px'}" v-if="show">
  4. <image :src="`/static/empty/${icons[icon]}`" 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. icons: {
  21. content: 'content.png', // 内容
  22. }
  23. }
  24. },
  25. props: {
  26. icon: {
  27. type: String,
  28. default: 'order'
  29. },
  30. text: {
  31. type: String,
  32. default: '暂无内容'
  33. },
  34. // 顶部距离
  35. top: {
  36. type: Number,
  37. default: 100
  38. },
  39. // 是否显示组件
  40. show: {
  41. type: Boolean,
  42. default: true
  43. },
  44. },
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .center {
  49. display: flex;
  50. justify-content: center;
  51. align-items: center;
  52. }
  53. .ui-empty {
  54. flex-direction: column;
  55. &__text {
  56. font-size: 32rpx;
  57. margin-top: 10rpx;
  58. color: #999;
  59. }
  60. &__wrap {
  61. flex-direction: column;
  62. color: #999;
  63. font-size: 26rpx;
  64. margin-top: 10rpx;
  65. }
  66. }
  67. .empty-icon {
  68. width: 260rpx;
  69. height: 260rpx;
  70. }
  71. .select-btn {
  72. margin-top: 50rpx;
  73. color: $color-primary;
  74. font-size: 26rpx;
  75. border-radius: 50rpx;
  76. border-color: $color-primary;
  77. }
  78. </style>