Vue
Based on Vue 3.5. Always use Composition API with <script setup lang="ts">.
Preferences
- Prefer TypeScript over JavaScript
- Prefer
<script setup lang="ts"> over <script>
- For performance, prefer
shallowRef over ref if deep reactivity is not needed
- Always use Composition API over Options API
- Discourage using Reactive Props Destructure
Core
| Topic |
Description |
Reference |
| Script Setup & Macros |
<script setup>, defineProps, defineEmits, defineModel, defineExpose, defineOptions, defineSlots, generics |
script-setup-macros |
| Reactivity & Lifecycle |
ref, shallowRef, computed, watch, watchEffect, effectScope, lifecycle hooks, composables |
core-new-apis |
Features
| Topic |
Description |
Reference |
| Built-in Components & Directives |
Transition, Teleport, Suspense, KeepAlive, v-memo, custom directives |
advanced-patterns |
Quick Reference
Component Template
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'
const props = defineProps<{
title: string
count?: number
}>()
const emit = defineEmits<{
update: [value: string]
}>()
const model = defineModel<string>()
const doubled = computed(() => (props.count ?? 0) * 2)
watch(
() => props.title,
(newVal) => {
console.log('Title changed:', newVal)
}
)
onMounted(() => {
console.log('Component mounted')
})
</script>
<template>
<div>{{ title }} - {{ doubled }}</div>
</template>
Key Imports
// Reactivity
// Watchers
// Lifecycle
// Utilities
import {
computed,
defineAsyncComponent,
defineComponent,
nextTick,
onBeforeMount,
onBeforeUnmount,
onBeforeUpdate,
onMounted,
onUnmounted,
onUpdated,
onWatcherCleanup,
reactive,
readonly,
ref,
shallowRef,
toRef,
toRefs,
toValue,
watch,
watchEffect,
watchPostEffect
} from 'vue'
Source: onderwijsin/buitenkans — distributed by TomeVault.
1---2name: vue-323description: Vue 3 Composition API, script setup macros, reactivity system, and built-in components. Use when writing Vue SFCs, defineProps/defineEmits/defineModel, watchers, or using Transition/Teleport/Suspense/KeepAlive.4---56# Vue78> Based on Vue 3.5. Always use Composition API with `<script setup lang="ts">`.910## Preferences1112- Prefer TypeScript over JavaScript13- Prefer `<script setup lang="ts">` over `<script>`14- For performance, prefer `shallowRef` over `ref` if deep reactivity is not needed15- Always use Composition API over Options API16- Discourage using Reactive Props Destructure1718## Core1920| Topic | Description | Reference |21| ---------------------- | ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |22| Script Setup & Macros | `<script setup>`, defineProps, defineEmits, defineModel, defineExpose, defineOptions, defineSlots, generics | [script-setup-macros](references/script-setup-macros.md) |23| Reactivity & Lifecycle | ref, shallowRef, computed, watch, watchEffect, effectScope, lifecycle hooks, composables | [core-new-apis](references/core-new-apis.md) |2425## Features2627| Topic | Description | Reference |28| -------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------------- |29| Built-in Components & Directives | Transition, Teleport, Suspense, KeepAlive, v-memo, custom directives | [advanced-patterns](references/advanced-patterns.md) |3031## Quick Reference3233### Component Template3435```vue36<script setup lang="ts">37import { computed, onMounted, ref, watch } from 'vue'3839const props = defineProps<{40 title: string41 count?: number42}>()4344const emit = defineEmits<{45 update: [value: string]46}>()4748const model = defineModel<string>()4950const doubled = computed(() => (props.count ?? 0) * 2)5152watch(53 () => props.title,54 (newVal) => {55 console.log('Title changed:', newVal)56 }57)5859onMounted(() => {60 console.log('Component mounted')61})62</script>6364<template>65 <div>{{ title }} - {{ doubled }}</div>66</template>67```6869### Key Imports7071```ts72// Reactivity73// Watchers7475// Lifecycle7677// Utilities78import {79 computed,80 defineAsyncComponent,81 defineComponent,82 nextTick,83 onBeforeMount,84 onBeforeUnmount,85 onBeforeUpdate,86 onMounted,87 onUnmounted,88 onUpdated,89 onWatcherCleanup,90 reactive,91 readonly,92 ref,93 shallowRef,94 toRef,95 toRefs,96 toValue,97 watch,98 watchEffect,99 watchPostEffect100} from 'vue'101```102103---104> Source: [onderwijsin/buitenkans](https://github.com/onderwijsin/buitenkans) — distributed by [TomeVault](https://tomevault.io).105<!-- tomevault:4.0:skill_md:2026-04-26 -->