# Vue 3 Code Review Guide > Vue 3 Composition API 代码审查指南,覆盖响应性系统、Props/Emits、Watchers、Composables 等核心主题。 --- ## 响应性系统 ### 解构 reactive 对象 ```vue ``` ### computed 副作用 ```vue ``` --- ## Props & Emits ### 直接修改 props ```vue ``` ### defineProps 类型声明 ```vue ``` --- ## Watchers ### watch 清理函数 ```vue ``` --- ## 模板最佳实践 ### v-for 的 key ```vue ``` ### v-if 和 v-for 优先级 ```vue ``` --- ## Composables ### Props 传递给 composable ```vue ``` --- ## Vue 3 Review Checklist ### 响应性系统 - [ ] ref 用于基本类型,reactive 用于对象 - [ ] 没有解构 reactive 对象(或使用了 toRefs) - [ ] props 传递给 composable 时保持了响应性 - [ ] shallowRef/shallowReactive 用于大型对象优化 ### Props & Emits - [ ] defineProps 使用 TypeScript 类型声明 - [ ] 复杂默认值使用 withDefaults + 工厂函数 - [ ] defineEmits 有完整的类型定义 - [ ] 没有直接修改 props ### Watchers - [ ] watch/watchEffect 有适当的清理函数 - [ ] 异步 watch 处理了竞态条件 - [ ] flush: 'post' 用于 DOM 操作的 watcher - [ ] 避免过度使用 watcher(优先用 computed) ### 模板 - [ ] v-for 使用唯一且稳定的 key - [ ] v-if 和 v-for 没有在同一元素上 - [ ] 事件处理使用 kebab-case - [ ] 大型列表使用虚拟滚动 ### Composables - [ ] 相关逻辑提取到 composables - [ ] composables 返回响应式引用(不是 .value) - [ ] 纯函数不要包装成 composable - [ ] 副作用在组件卸载时清理 ### 性能 - [ ] 大型组件拆分为小组件 - [ ] 使用 defineAsyncComponent 懒加载 - [ ] 避免不必要的响应式转换 - [ ] v-memo 用于昂贵的列表渲染