From e3f28a82c92d799832cc0a1269d2891de7d09ce4 Mon Sep 17 00:00:00 2001 From: zheng020 Date: Tue, 2 Jun 2026 19:37:09 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=95=B0=E6=8D=AE=E7=9C=8B=E6=9D=BF=20?= =?UTF-8?q?spec=20=E8=A1=A5=E5=85=85=20effectScope=20=E4=B8=8E=206/7=20?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 应用 spec reviewer 的两条建议:澄清 composable 用 effectScope 释放 资源(非依赖 onUnmounted),并显式说明 6 组件消费 7 接口的映射 (CollectionMatrix 内部消费 3 个)。 Co-Authored-By: Claude Opus 4.7 --- .../specs/2026-06-02-data-dashboard-frontend-design.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/superpowers/specs/2026-06-02-data-dashboard-frontend-design.md b/docs/superpowers/specs/2026-06-02-data-dashboard-frontend-design.md index ed92e9f..e5b5377 100644 --- a/docs/superpowers/specs/2026-06-02-data-dashboard-frontend-design.md +++ b/docs/superpowers/specs/2026-06-02-data-dashboard-frontend-design.md @@ -18,6 +18,13 @@ - 加载/空/错误三态 - mock 数据接入 +**6 组件 ↔ 7 接口映射**: +- CrystalOverview → 1 个接口(today-overview) +- IncomeCurve → 1 个接口(income-curve) +- ExhibitionCenter → 1 个接口(exhibition-summary) +- LikeIncomeBoard → 1 个接口(like-income-by-level) +- CollectionMatrix(容器)→ **3 个接口**(top-assets、level-distribution、upgrade-progress),子组件各消费其一 + **Out of scope(不在本文档)**: - 后端 dashboardService 实现(详见配套文档第 4 节) - Figma 素材下载(项目自有 `static/components/` 已含同类资源) @@ -145,7 +152,7 @@ const { - 单 section 失败 → 该 section `data` 保持 `null`、`error` 有值、UI 显示重试 - `refresh('curve')`:只重拉 curve 一个 section - `refresh({ force: true })`:绕过 `lastFetched` 缓存 -- `onUnmounted` 自动清空所有 state(依赖 Vue 3 组件卸载生命周期) +- **资源释放**:composable 内部用 `effectScope` 包裹请求与状态;dashboard.vue 在 `onUnmounted` 中调用 composable 暴露的 `dispose()` 释放 effectScope,确保 `setTimeout`/Promise 回调不污染已卸载组件 ### 4.3 子组件 Props 契约