--- name: fix-tree-component overview: 修复 fms-vue 中 Tree 组件的多个缺陷:致命运行时错误(filterExpand 未定义)、受控键模型遗漏、过滤高亮缺失、键盘焦点不同步、展开交互混乱与拖拽视觉残留,并同步完善 demo。 todos: - id: fix-critical-errors content: 修复 tree.vue 中 filterExpand 未定义导致的渲染崩溃,并补充缺失的 defaultLoadedKeys prop status: completed - id: refactor-expand-select content: 重构展开/选中交互:加回 switcher 箭头、toggleExpand 改用用户展开集合、行点击只选中并同步键盘焦点,参考 [skill:antdv-next] 交互规范 status: completed dependencies: - fix-critical-errors - id: filter-highlight content: 在 tree-node.vue 实现过滤关键词高亮渲染,命中片段包裹 tree-highlight status: completed dependencies: - fix-critical-errors - id: fix-drag-cleanup content: 修复 onDragLeave 未清理 drop 状态导致的指示线残留,并清理 index.scss 无用样式 status: completed dependencies: - fix-critical-errors - id: fix-demo content: 修正 demo/tree.vue 中 check-strictly 示例绑定与联动文案错乱问题 status: completed - id: verify-build content: 运行 pnpm lint、fmt:check 与 build 验证修复无回归 status: completed dependencies: - refactor-expand-select - filter-highlight - fix-drag-cleanup - fix-demo --- ## 用户需求 用户反馈 `fms-vue/src/components/ui/tree` 组件由上一个 AI 编写,存在较多问题,要求自检问题并修复。经过代码自检,已确认以下问题: ## 核心问题 - **致命错误**:`tree.vue` 的 `effectiveExpanded` computed 引用了未定义的 `filterExpand` 变量,组件渲染即抛 `ReferenceError`,Tree 完全不可用 - **Props 缺失**:`useKeyModel('loadedKeys', 'defaultLoadedKeys', ...)` 引用了不存在的 `defaultLoadedKeys` prop - **过滤高亮缺失**:`filterTree` 返回的命中集合与 `.tree-highlight` 样式均未用于渲染关键词高亮 - **展开交互缺陷**:展开/收起箭头被移除,无可展开视觉提示;行点击同时触发展开与选中造成误触;`toggleExpand` 基于 `effectiveExpanded` 会把过滤临时展开的祖先固化进用户展开集合 - **键盘导航缺陷**:点击节点后未同步 `activeKey` 与焦点,键盘导航起点错乱 - **拖拽视觉残留**:`onDragLeave` 未清理 `dropKey`/`dropPosition`,指示线残留 - **样式残留**:`.tree-node.is-danger`、`.tree-leaf-icon` 等无用样式 - **Demo 错乱**:check-strictly 示例未绑定 checkedKeys,联动文案错标在严格模式示例下 ## 修复范围 仅修复内部实现与 demo 演示,保持组件既有 API(props/emits/slot 名称)不变,不引入新依赖,样式沿用现有 `--fms-*` token。 ## 技术栈 - Vue 3.5(`