s-empty.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view
  3. class="ss-flex-col ss-col-center ss-row-center empty-box"
  4. :style="[{ paddingTop: paddingTop + 'rpx' }]"
  5. >
  6. <view class=""><image class="empty-icon" :src="icon" mode="widthFix"></image></view>
  7. <view class="empty-text ss-m-t-28 ss-m-b-40">
  8. <text v-if="text !== ''">{{ text }}</text>
  9. </view>
  10. <button class="ss-reset-button empty-btn" v-if="showAction" @tap="clickAction">
  11. {{ actionText }}
  12. </button>
  13. </view>
  14. </template>
  15. <script setup>
  16. import sheep from '@/sheep';
  17. /**
  18. * 容器组件 - 装修组件的样式容器
  19. */
  20. const props = defineProps({
  21. // 图标
  22. icon: {
  23. type: String,
  24. default: '',
  25. },
  26. // 描述
  27. text: {
  28. type: String,
  29. default: '',
  30. },
  31. // 是否显示button
  32. showAction: {
  33. type: Boolean,
  34. default: false,
  35. },
  36. // button 文字
  37. actionText: {
  38. type: String,
  39. default: '',
  40. },
  41. // 链接
  42. actionUrl: {
  43. type: String,
  44. default: '',
  45. },
  46. // 间距
  47. paddingTop: {
  48. type: String,
  49. default: '260',
  50. },
  51. //主题色
  52. buttonColor: {
  53. type: String,
  54. default: 'var(--ui-BG-Main)',
  55. },
  56. });
  57. const emits = defineEmits(['clickAction']);
  58. function clickAction() {
  59. if (props.actionUrl !== '') {
  60. sheep.$router.go(props.actionUrl);
  61. }
  62. emits('clickAction');
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .empty-box {
  67. width: 100%;
  68. }
  69. .empty-icon {
  70. width: 240rpx;
  71. }
  72. .empty-text {
  73. font-size: 26rpx;
  74. font-weight: 500;
  75. color: #999999;
  76. }
  77. .empty-btn {
  78. width: 320rpx;
  79. height: 70rpx;
  80. border: 2rpx solid v-bind('buttonColor');
  81. border-radius: 35rpx;
  82. font-weight: 500;
  83. color: v-bind('buttonColor');
  84. font-size: 28rpx;
  85. }
  86. </style>