-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add Vue 3 Composition API best practices and folder structure
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |