| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <template>
- <view class="empty-box">
- <text v-if="icon" class="empty-icon">{{ icon }}</text>
- <text class="empty-title">{{ title }}</text>
- <text v-if="desc" class="empty-desc">{{ desc }}</text>
- <button v-if="actionText" class="empty-btn" @click="handleAction">{{ actionText }}</button>
- </view>
- </template>
- <script>
- /**
- * 空态占位(分子组件):统一文案/图标/CTA
- */
- export default {
- name: 'EmptyState',
- props: {
- icon: { type: String, default: '📭' },
- title: { type: String, default: '暂无数据' },
- desc: { type: String, default: '' },
- actionText: { type: String, default: '' }
- },
- methods: {
- handleAction() {
- this.$emit('action')
- }
- }
- }
- </script>
- <style scoped>
- .empty-box {
- background: #FFFFFF;
- border: 1px solid #E3ECF4;
- border-radius: 20rpx;
- padding: 56rpx 36rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .empty-icon { font-size: 72rpx; margin-bottom: 20rpx; }
- .empty-title { font-size: 30rpx; font-weight: 600; color: #1F4E79; margin-bottom: 12rpx; }
- .empty-desc { font-size: 24rpx; color: #3B5A78; text-align: center; line-height: 1.7; margin-bottom: 28rpx; }
- .empty-btn {
- width: 60%;
- height: 80rpx;
- line-height: 80rpx;
- background: #2E6FA8;
- color: #FFFFFF;
- font-size: 28rpx;
- font-weight: 600;
- border-radius: 40rpx;
- border: none;
- padding: 0;
- }
- .empty-btn:active { opacity: 0.9; }
- </style>
|