结果页 Result
Result
组件用于展示错误、空状态、或者其他需要呈现的状态信息,如 403
、404
、500
错误页面。它包括了图标、标题、副标题以及额外的操作 按钮,方便在各种页面中复用。
📦 引入方式
import { Result } from '@npmqg/react-ui-result';
🧩 使用示例
📚 默认 404 页面
- 示例
- 源码
🔍
Page Not Found
Sorry, the page you visited does not exist.
<Result className="h-[200px]" title="Page Not Found" subTitle="Sorry, the page you visited does not exist." />
📚 自定义图标
- 示例
- 源码
⚠️
Internal Server Error
Something went wrong, please try again later.
<Result
className="h-[200px]"
status="500"
title="Internal Server Error"
subTitle="Something went wrong, please try again later."
icon={<div className="text-6xl text-red-500">⚠️</div>}
/>
📚 额外操作按钮
- 示例
- 源码
🔍
Page Not Found
Sorry, the page you visited does not exist.
<Result
className="h-[200px]"
status="404"
title="Page Not Found"
subTitle="Sorry, the page you visited does not exist."
extra={<button onClick={() => (window.location.href = '/')}>Go Home</button>}
/>
🧩 组件结构
属性 |
---|