组件/ErrorState 错误状态
自 2.4.7BETA

ErrorState 错误状态

错误场景的快捷空态组件,基于 TxEmptyState 的 `variant="error"` 预设。

该页面由 AI 迁移生成,请谨慎使用

内容已迁移完成,但仍建议结合源码和人工评审结果使用。

ErrorState 错误状态

TxErrorStateTxEmptyState 的快捷封装,自动设置 variant="error",用于请求失败、系统异常等场景。

基础用法

使用默认标题和描述,搭配操作按钮。

ErrorState (basic)

示例即将加载...
<template>
  <TxErrorState
    :primary-action="{ label: 'Retry', type: 'primary' }"
    :secondary-action="{ label: 'Go Back' }"
  />
</template>

自定义内容

通过 props 覆盖默认标题、描述,配合 surface="card" 呈现卡片风格。

ErrorState (custom)

示例即将加载...
<template>
  <TxErrorState
    title="Failed to load data"
    description="The server returned error 500. Please check your network and try again."
    surface="card"
    :primary-action="{ label: 'Retry', type: 'primary' }"
  />
</template>

API

TxErrorState 继承 TxEmptyState 的全部 Props(除 variant)、Slots 和 Events,详见 EmptyState

Props

属性名类型默认值说明
titlestring'Something went wrong'标题(可覆盖)
descriptionstring'Please try again later.'描述(可覆盖)
layout'vertical' | 'horizontal''vertical'布局方向
align'start' | 'center' | 'end''center'对齐方式
size'small' | 'medium' | 'large''medium'尺寸等级
surface'plain' | 'card''plain'表面风格
primaryActionEmptyStateAction-主操作配置
secondaryActionEmptyStateAction-次操作配置

完整 Props 参考 EmptyState API

交互契约

  • TxErrorState 始终向 TxEmptyState 透传 variant="error"
  • 组件不额外改写 titledescriptionsurface 或 action 配置;显式 props 会原样透传。
  • icontitledescriptionactions 插槽会原样转发给 TxEmptyState