# Components ## Props with TypeScript ```vue {{ title }} Count: {{ count }} ``` ## Emits (Events) ```vue Update Delete ``` ## v-model (Two-way Binding) ```vue Books Electronics ``` ## Slots ```vue Card Title Main content goes here Close ``` ## Scoped Slots (Advanced) ```vue {{ index }}: {{ item.name }} ``` ## Provide/Inject ```vue User: {{ user?.name }} Theme: {{ theme }} Update User ``` ## Teleport ```vue Show Modal Modal Title Modal content Close Notification message Only teleported on mobile ``` ## Dynamic Components ```vue Home About Contact ``` ## Async Components ```vue Loading... ``` ## Quick Reference | Pattern | Use Case | |---------|----------| | `defineProps()` | Type-safe props with TypeScript | | `withDefaults()` | Props with default values | | `defineEmits()` | Type-safe event emitters | | `v-model` | Two-way data binding | | `` | Content distribution | | Scoped slots | Pass data from child to parent | | `provide/inject` | Dependency injection (avoid prop drilling) | | `` | Render DOM outside component hierarchy | | `` | Dynamic component switching | | `defineAsyncComponent()` | Lazy load components |
Count: {{ count }}
Main content goes here
User: {{ user?.name }}
Theme: {{ theme }}
Modal content