--- name: fms-tree-component overview: 基于 shadcn-vue 模式(reka-ui Collapsible + ContextMenu + Tailwind v4 + Vue 3 Composition API)从零封装 FmsTree/FmsTreeNode 组件,含虚拟根节点、右键菜单、展开折叠、节点选中、键盘导航。本次不做多语言。 design: architecture: framework: vue component: shadcn styleKeywords: - shadcn-vue - new-york - Minimalism - Clean fontSystem: fontFamily: Inter heading: size: 14px weight: 500 subheading: size: 12px weight: 400 body: size: 13px weight: 400 colorSystem: primary: - var(--primary) - var(--accent) background: - var(--background) - var(--accent) - transparent text: - var(--foreground) - var(--muted-foreground) - var(--accent-foreground) functional: - var(--border) - var(--ring) todos: - id: create-fms-tree-node content: 创建 components/FmsTreeNode.vue 递归节点组件,基于 Collapsible + ContextMenu 实现展开折叠、选中高亮、右键菜单、键盘导航 status: completed - id: create-fms-tree content: 创建 components/FmsTree.vue 根组件,实现虚拟根节点包裹、props 定义、v-model 双向绑定、事件转发和 slot 透传 status: completed dependencies: - create-fms-tree-node - id: verify-and-format content: 验证组件可正常渲染,运行 pnpm fmt:check 检查格式 status: completed dependencies: - create-fms-tree --- ## 产品概述 在新系统 fms-vue 中封装一个可复用的 FmsTree 树组件,基于 shadcn-vue(reka-ui + Tailwind v4)技术栈,为模块管理等场景提供统一的树交互体验。本次不做多语言、拖拽、虚拟滚动。 ## 核心功能 - 树形结构展示:递归渲染节点,支持无限层级嵌套 - 展开/折叠:点击箭头图标展开或折叠子节点,支持 v-model:expandedKeys 受控模式 - 节点选中:点击节点高亮选中,支持 v-model:selectedKeys,单选模式 - 虚拟根节点:treeData 外层自动包裹虚拟根节点(如 全部分类),确保首次加载时树处于展开可交互状态 - 右键菜单:通过 contextMenu prop 传入菜单项生成函数,右键节点弹出 ContextMenu - 标题插槽:支持 #title slot 自定义节点标题渲染 - 键盘导航:ArrowUp/Down 切换焦点,ArrowRight/Left 展开折叠,Enter 选中 ## 技术栈 - Vue 3 Composition API + TypeScript(`