From e0cd3010d3b6a77d26a81ddcc1372e5b495a18ea Mon Sep 17 00:00:00 2001 From: iFwu Date: Fri, 8 Nov 2024 23:16:57 +0800 Subject: [PATCH] docs: Add Vue 3 Composition API best practices and folder structure --- .cursorrules | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .cursorrules diff --git a/.cursorrules b/.cursorrules new file mode 100644 index 0000000..499febd --- /dev/null +++ b/.cursorrules @@ -0,0 +1,27 @@ +Vue 3 Composition API best practices: +1. Use setup() function for component logic +2. Utilize ref and reactive for reactive state +3. Implement computed properties with computed() +4. Use watch and watchEffect for side effects +5. Implement lifecycle hooks with onMounted, onUpdated, etc. +6. Utilize provide/inject for dependency injection + +Folder structure: +src/ + components/ + composables/ + views/ + router/ + store/ + assets/ + App.vue + main.ts + +Additional instructions: +1. Use TypeScript for type safety +2. Implement proper props and emits definitions +3. Utilize Vue 3's Teleport component when needed +4. Use Suspense for async components +5. Implement proper error handling +6. Follow Vue 3 style guide and naming conventions +7. Use Vite for fast development and building