van-empty.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="v-empty">
  3. <view class="v-empty__card">
  4. <view class="v-empty__blob">
  5. <image
  6. class="v-empty__icon"
  7. src="/static/empty-inbox.svg"
  8. mode="aspectFit"
  9. />
  10. </view>
  11. <text class="v-empty__desc">{{ description || '暂无数据' }}</text>
  12. <text v-if="tip" class="v-empty__tip">{{ tip }}</text>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. /** H5 兼容:替代 @vant/weapp van-empty(方案 B 虚线软卡) */
  18. export default {
  19. name: 'VanEmptyShim',
  20. props: {
  21. description: { type: String, default: '' },
  22. tip: { type: String, default: '' }
  23. }
  24. }
  25. </script>
  26. <style scoped>
  27. .v-empty {
  28. display: flex;
  29. flex-direction: column;
  30. align-items: stretch;
  31. padding: 16rpx 0;
  32. }
  33. .v-empty__card {
  34. display: flex;
  35. flex-direction: column;
  36. align-items: center;
  37. justify-content: center;
  38. gap: 16rpx;
  39. padding: 44rpx 28rpx 40rpx;
  40. border-radius: 28rpx;
  41. background: linear-gradient(165deg, #eef9f3 0%, #ffffff 55%);
  42. border: 3rpx dashed #b7e5d0;
  43. box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.8);
  44. }
  45. .v-empty__blob {
  46. width: 128rpx;
  47. height: 128rpx;
  48. border-radius: 50%;
  49. background: radial-gradient(circle at 35% 30%, #ffffff, #d8f3e7 70%);
  50. display: flex;
  51. align-items: center;
  52. justify-content: center;
  53. }
  54. .v-empty__icon {
  55. width: 56rpx;
  56. height: 56rpx;
  57. }
  58. .v-empty__desc {
  59. font-size: 26rpx;
  60. color: #5d746a;
  61. text-align: center;
  62. line-height: 1.4;
  63. }
  64. .v-empty__tip {
  65. font-size: 22rpx;
  66. color: #8aa198;
  67. text-align: center;
  68. line-height: 1.4;
  69. }
  70. </style>