feat(ui): add ErrorBoundary component for error handling in Vue

This commit is contained in:
RainbowBird
2026-04-25 17:23:43 +08:00
parent 7312e471bc
commit f292ab9b99
4 changed files with 139 additions and 2 deletions
+14
View File
@@ -126,6 +126,20 @@ Error display with copy/feedback buttons and scrollable stack trace.
**Emits**: `copy(content: string)`, `feedback()`
### ErrorBoundary
Catches synchronous render/setup errors in descendants via `onErrorCaptured` and renders a fallback (built-in `ContainerError` + retry button) instead of letting the error propagate. Use to wrap `<RouterView>` or any subtree where partial failure should not blank the host layout. Async/unhandled rejections are NOT captured — use `app.config.errorHandler` for those.
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `title` | `string?` | — | Optional title shown above error details |
| `retryable` | `boolean?` | `true` | Show built-in retry button |
| `retryLabel` | `string?` | `'Try again'` | Retry button label |
**Slots**: `default`, `fallback({ error, info, retry })`
**Emits**: `error(err, instance, info)`, `retry()`
**Exposed**: `retry()`, `hasError()`
### DoubleCheckButton
Two-stage confirmation button — click once to reveal confirm/cancel.