fetch-and-send-data
仓库创建 2026年2月4日最近提交 14 小时前SkillHot 收录 20 天前
▸ 精选理由
包含注册 HttpClient、加载/错误 UX 与跨渲染模式的数据抽象模式。
这个 Skill 做什么
在 Blazor 中调用 API、提交数据并处理异步加载与错误状态。
在 Blazor 应用里帮你把后端数据拿到组件、提交表单并做好加载与错误的异步体验管理。适合需要从 API 拉数据、在 Server/WebAssembly 模式间处理 HttpClient、展示 loading/error、封装服务调用时用。特别之处是覆盖不同渲染模式的生命周期细节,给出可复用的调用和错误处理模式。
▸ 展开 SKILL.md 英文原文
Call APIs, load data into components, and handle the async lifecycle in Blazor. USE FOR fetching data from a backend, submitting data to an API, displaying loading/error states, registering HttpClient, building service abstractions for Auto/WebAssembly render modes. DO NOT USE for form validation (see collect-user-input), prerendering persistence (see support-prerendering), or project scaffolding (see create-blazor-project).
4.8k
Stars
351
Forks
40
仓库内 Skill
+610
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-blazor/skills/fetch-and-send-data/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-blazor/skills/fetch-and-send-data/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# Fetch and Send Data ## Step 1 — Read AGENTS.md Check **Interactivity Mode** and **Scope**: | Mode | Data access | |------|-------------| | None (Static SSR) | Server-side: inject services/`DbContext`. Use `[StreamRendering]` for loading UX. | | Server | Server-side: inject services/`DbContext`. Guard prerender with `??=` + `[PersistentState]`. | | WebAssembly | Browser-side: `HttpClient` only. No direct server access. | | Auto | Both server and browser. Always go through an API. | ## Step 2 — Register HttpClient Only needed when calling external APIs from Server, or always for WebAssembly/Auto. Server components accessing their own database should inject `DbContext` or a service direc
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有