Vue 3 專案經常面臨類型檢查問題、儲存時間過長和配置問題。本技能提供針對 Vue 元件類型定義、Volar 配置和常見 Vue 3 開發問題的精選解決方案。
Télécharger le ZIP du skill
Importer dans Claude
Allez dans Paramètres → Capacités → Skills → Importer un skill
Activez et commencez à utiliser
Tester
Utilisation de "vue-best-practices". How do I enable strict template checking in Vue?
Résultat attendu:
- To enable strict template checking in vue-tsc, add vueCompilerOptions to your tsconfig.app.json:
- ```json
- {
- "compilerOptions": {
- "strict": true,
- "skipLibCheck": true
- },
- "vueCompilerOptions": {
- "strictTemplates": true,
- "checkUnknownComponents": true
- }
- }
- ```
- This will catch:
- - Undefined components used in templates
- - Props not declared in defineProps
- - Unknown events emitted by components
- - Unregistered custom directives
Utilisation de "vue-best-practices". Vue file saves are very slow
Résultat attendu:
- Save delays in Vue projects are often caused by VSCode code actions triggering TypeScript synchronization. Fix this by:
- 1. Disable code actions in .vscode/settings.json:
- ```json
- { "vue.codeActions.enabled": false }
- ```
- 2. Or limit code action timeout:
- ```json
- { "vue.codeActions.savingTimeLimit": 1000 }
- ```
- 3. Upgrade to VSCode 1.81.0+ which includes performance fixes
- This reduces save time from 30-60 seconds to under 2 seconds.
Audit de sécurité
SûrAll static findings are false positives. This skill contains only markdown documentation files with code examples for Vue 3 best practices. The detected patterns (shell commands, cryptographic references, URLs) appear in code blocks and documentation links, not executable code. No security risks present.
Problèmes à risque élevé (3)
Problèmes à risque moyen (2)
Problèmes à risque faible (1)
Score de qualité
Ce que vous pouvez construire
修復 Vue 模板類型錯誤
開發人員在 Vue 模板中遇到「未定義的元件」錯誤。本技能提供 tsconfig 配置以啟用嚴格模板檢查並解決這些問題。
優化大型專案儲存時間
開發人員在 Vue 專案中遇到 30-60 秒的儲存延遲。本技能說明如何配置 VSCode 程式碼動作設定來修復儲存效能問題。
類型安全的元件 Props
開發人員需要從 Vue 元件提取 prop 類型以用於包裝元件。本技能提供 TypeScript 輔助模式和 vue-component-type-helpers 的使用方法。
Essayez ces prompts
How do I enable strict template checking in vue-tsc to catch undefined components? My tsconfig is not catching component name typos.
My Vue project takes 30+ seconds to save files in VSCode. How do I fix slow save performance caused by code actions?
How do I extract prop types from a Vue component to use in a wrapper component? I need to type my Higher-Order Component correctly.
How do I properly type Vue Router route params with typed-router? My route params are not type-safe.
Bonnes pratiques
- Enable strictTemplates in vueCompilerOptions to catch template errors at compile time rather than runtime
- Use vue-component-type-helpers package for type-safe wrapper components and HOCs
- Configure tsconfig.app.json (not root tsconfig) for Vue source files in create-vue projects
Éviter
- Adding vueCompilerOptions to the root tsconfig.json instead of the app-specific tsconfig
- Not upgrading to VSCode 1.81.0+ when experiencing slow save times
- Using loose template checking in production codebases where type safety matters
Foire aux questions
What is the difference between vue-tsc and tsc?
Which tsconfig should I add vueCompilerOptions to?
Why are my Vue file saves so slow?
How do I extract prop types from a Vue component?
What does strictTemplates check?
How do I fix Vue plugin duplicate registration in Vite?
Détails du développeur
Structure de fichiers