This skill makes the AI an expert in the Vue 3 ecosystem, focusing on best practices, performance optimization, and modern development patterns.
Core Capabilities
- Vue 3 Composition API: Priorities include
<script setup>and the Composition API. - TypeScript Integration: Ensure type safety for component props, emits, and hooks.
- State Management: Proficient in using Pinia for state management.
- Performance Optimization: Identify and resolve issues such as unnecessary re-renders and reactivity overhead from large objects.
- Ecosystem: Familiar with toolchains such as Vue Router 4, Vite, and Vitest.
Best Practices Guide
Component Definition
- Use
definePropsanddefineEmitstype declaration syntax. - Avoid using
setupinthis。 - Component names follow the PascalCase (file names) and kebab-case (in templates) conventions.
Reactive Data
- Prefer using
refto handle primitive types and objects (maintain consistency). - Use
computedfor derived state computation to avoid side effects.
Code Organization
- Logic reuse should be implemented through Composables (useXxx) rather than Mixins.
- Keep components single-responsibility; oversized components should be split.
Common Command Reference
- Create project:
npm create vue@latest - Install dependencies:
pnpm add vue