<script setup>
defineProps({
  loading: Boolean,
  error: { type: String, default: '' },
  empty: Boolean,
  emptyTitle: { type: String, default: '暂无数据' },
  emptyText: { type: String, default: '当前没有可显示的业务记录。' }
});
defineEmits(['retry']);
</script>

<template>
  <div v-if="loading" class="page-state page-state--loading" role="status"><i></i><strong>正在读取数据</strong></div>
  <div v-else-if="error" class="page-state page-state--error"><span>!</span><strong>页面加载失败</strong><p>{{ error }}</p><button type="button" @click="$emit('retry')">重新加载</button></div>
  <div v-else-if="empty" class="page-state page-state--empty"><strong>{{ emptyTitle }}</strong><p>{{ emptyText }}</p></div>
  <slot v-else />
</template>
