chore: 移除未使用的前端组件
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 16s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

- 删除 SmartClassifyButton.vue (无引用)
- 删除 BudgetSummary.vue (无引用)
- 归档变更记录
This commit is contained in:
SunCheng
2026-02-20 22:39:29 +08:00
parent 5f9672744b
commit b173c83134
13 changed files with 163 additions and 709 deletions

View File

@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-02-20

View File

@@ -0,0 +1,54 @@
## Context
前端组件库存在两个未被引用的组件:
- `SmartClassifyButton.vue` - 智能分类按钮,历史上可能用于快速分类功能,现已无引用
- `BudgetSummary.vue` - 预算汇总卡片,功能已被 budgetV2 模块的子组件替代
当前打包工具Vite的 tree-shaking 会移除未引用代码,但保留源文件会增加维护困惑和代码审查负担。
## Goals / Non-Goals
**Goals:**
- 移除确认无引用的组件文件
- 保持代码库整洁,降低维护成本
**Non-Goals:**
- 不涉及 `TransactionDetail.vue` vs `TransactionDetailSheet.vue` 的重构(两者虽然功能相似,但均有活跃引用)
- 不涉及其他代码清理(如未使用的 composables、utils
## Decisions
### 1. 删除策略:直接删除 vs 废弃标记
**决策**: 直接删除
**理由**:
- 两个组件均无任何 import 引用,删除零风险
- 无需废弃过渡期,因为没有使用方需要迁移
- 简化变更流程,避免留下无效的废弃代码
**备选方案**: 添加 `@deprecated` 注释并在下个版本删除 - 过度工程化,不必要
### 2. 回归验证范围
**决策**: 仅验证打包成功和页面正常渲染
**理由**:
- 删除的是零引用组件,理论上不会有任何运行时影响
- 全量 E2E 测试成本过高,性价比低
## Risks / Trade-offs
| 风险 | 影响 | 缓解措施 |
|------|------|----------|
| 误删有引用的组件 | 页面报错 | 已通过 grep 全量搜索确认无引用 |
| 动态引用未被发现 | 运行时报错 | 检查了 `:is` 动态组件和字符串引用模式 |
## Migration Plan
1. 删除 `SmartClassifyButton.vue`
2. 删除 `BudgetSummary.vue`
3. 运行 `pnpm build` 验证打包成功
4. 运行 `pnpm dev` 启动开发服务器,访问主要页面验证无报错
**回滚策略**: Git revert 即可恢复

View File

@@ -0,0 +1,28 @@
## Why
前端代码库中存在未使用的组件,增加了维护成本和打包体积。作为大版本迭代的清理工作,需要识别并移除这些无效代码,保持代码库整洁。
## What Changes
- 删除 `SmartClassifyButton.vue` - 无任何引用
- 删除 `BudgetSummary.vue` - 无任何引用
- 评估 `TransactionDetail.vue``TransactionDetailSheet.vue` 的重复问题(两者功能相似,需确认是否可合并)
## Capabilities
### New Capabilities
无新增能力。
### Modified Capabilities
无需求变更。此变更为代码清理,不影响业务功能。
## Impact
- **删除文件**:
- `Web/src/components/SmartClassifyButton.vue`
- `Web/src/components/Budget/BudgetSummary.vue`
- **风险评估**: 低风险。两个组件均无任何导入引用
- **打包体积**: 减少无效代码约 ~5KB (gzip)
- **测试影响**: 无需新增测试,仅需回归验证

View File

@@ -0,0 +1,13 @@
## Overview
此变更为代码清理,不涉及业务需求变更。
## REMOVED Components
### Requirement: SmartClassifyButton component
**Reason**: 组件无任何引用,已被废弃
**Migration**: 无需迁移,该组件从未被使用
### Requirement: BudgetSummary component
**Reason**: 功能已被 budgetV2 模块的子组件替代
**Migration**: 使用 `BudgetCard.vue``BudgetChartAnalysis.vue` 替代

View File

@@ -0,0 +1,9 @@
## 1. 移除未使用组件
- [x] 1.1 删除 `Web/src/components/SmartClassifyButton.vue`
- [x] 1.2 删除 `Web/src/components/Budget/BudgetSummary.vue`
## 2. 验证
- [x] 2.1 运行 `pnpm build` 验证打包成功
- [x] 2.2 运行 `pnpm dev` 启动开发服务器,访问主要页面验证无报错