s-empty.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. const emits = defineEmits(['clickAction']);
  53. function clickAction() {
  54. if (props.actionUrl !== '') {
  55. sheep.$router.go(props.actionUrl);
  56. }
  57. emits('clickAction');
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .empty-box {
  62. width: 100%;
  63. }
  64. .empty-icon {
  65. width: 240rpx;
  66. }
  67. .empty-text {
  68. font-size: 26rpx;
  69. font-weight: 500;
  70. color: #999999;
  71. }
  72. .empty-btn {
  73. width: 320rpx;
  74. height: 70rpx;
  75. border: 2rpx solid var(--ui-BG-Main);
  76. border-radius: 35rpx;
  77. font-weight: 500;
  78. color: var(--ui-BG-Main);
  79. font-size: 28rpx;
  80. }
  81. </style>