error-state.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="error-box">
  3. <text class="error-icon">⚠️</text>
  4. <text class="error-title">{{ message }}</text>
  5. <text class="error-sub">请检查网络后重试</text>
  6. <button class="error-btn" @click="handleRetry">重新加载</button>
  7. </view>
  8. </template>
  9. <script>
  10. /**
  11. * 错误态 + 重试(分子组件)
  12. */
  13. export default {
  14. name: 'ErrorState',
  15. props: {
  16. message: { type: String, default: '加载失败' }
  17. },
  18. methods: {
  19. handleRetry() {
  20. this.$emit('retry')
  21. }
  22. }
  23. }
  24. </script>
  25. <style scoped>
  26. .error-box {
  27. background: #FFFFFF;
  28. border: 1px solid #E3ECF4;
  29. border-radius: 20rpx;
  30. padding: 60rpx 40rpx;
  31. margin-top: 60rpx;
  32. display: flex;
  33. flex-direction: column;
  34. align-items: center;
  35. }
  36. .error-icon { font-size: 64rpx; margin-bottom: 20rpx; }
  37. .error-title { font-size: 30rpx; font-weight: 600; color: #1F4E79; margin-bottom: 10rpx; }
  38. .error-sub { font-size: 24rpx; color: #3B5A78; margin-bottom: 32rpx; }
  39. .error-btn {
  40. width: 60%;
  41. height: 80rpx;
  42. line-height: 80rpx;
  43. background: #2E6FA8;
  44. color: #FFFFFF;
  45. font-size: 28rpx;
  46. font-weight: 600;
  47. border-radius: 40rpx;
  48. border: none;
  49. padding: 0;
  50. }
  51. .error-btn:active { opacity: 0.9; }
  52. </style>