Vue docs, chapter by chapter

API reference map

The Vue API reference as a quiz sheet — application API and config, general helpers, every built-in directive with its modifiers, special elements and attributes, the SFC spec and script setup rules, reactivity utilities, compile-time flags and the SSR API.

The reference is what you are quizzed on when the interviewer wants precision: "which directive skips compilation", "what does v-bind.prop do", "what is v-cloak for", "which flag exposes hydration mismatch details in production". This page is the map; the API pages are the territory.

Know — Application API

  • createApp(), createSSRApp(), app.mount(), app.unmount(), app.onUnmount() (3.5), app.component(), app.directive(), app.use(), app.mixin(), app.provide(), app.runWithContext(), app.version.
  • app.config: errorHandler, warnHandler, performance, compilerOptions (isCustomElement, whitespace, delimiters, comments), globalProperties, optionMergeStrategies, idPrefix (3.5, prefixes useId), throwUnhandledErrorInProduction (3.5).
  • General: version, nextTick(), defineComponent(), defineAsyncComponent().

Know — Built-in directives

  • v-text, v-html, v-show, v-if / v-else / v-else-if, v-for, v-on (@), v-bind (:), v-model, v-slot (#), v-pre (skip compilation of the element and children; shows raw mustaches), v-once (render once, then treat as static), v-memo (skip updates unless the dependency array changed; with v-for it must be on the same element), v-cloak (attribute removed when compilation finishes; used with [v-cloak] { display: none } to hide un-compiled in-DOM templates).
  • v-bind modifiers: .camel (camelize the attribute name in in-DOM templates), .prop (force a DOM property; shorthand .prop-name), .attr (force an attribute). v-on modifiers: the event, key, system and mouse modifiers, plus .passive, .capture, .once, .self, .stop, .prevent. v-model modifiers: .lazy, .number, .trim.

Know — Built-in components, special elements and attributes

  • Components: <Transition>, <TransitionGroup>, <KeepAlive>, <Teleport>, <Suspense>.
  • Special elements: <component :is> (string or component; native tags by name), <slot>, <template> (with a directive it is a wrapper; with #slot it is slot content; otherwise a native element).
  • Special attributes: key (identity hint, forces replacement when changed), ref (template ref), is (dynamic component; vue: prefix makes a native element render as a component in in-DOM templates).

Know — SFC spec and script setup

  • Language blocks: at most one <template> and one normal <script>, plus one <script setup>; any number of <style>; custom blocks. lang for pre-processors, src imports, comments in HTML syntax, automatic name inference from the filename.
  • <script setup>: top-level bindings are exposed to the template; imports too (usable directly, including components and v directives); compiler macros defineProps, defineEmits, defineModel, defineExpose, defineOptions, defineSlots; useSlots()/useAttrs(); may coexist with a normal <script> for named exports or options that need it; top-level await makes the component async (requires Suspense); generics attribute; restrictions: no src attribute and no in-DOM templates.
  • CSS features: scoped, modules, v-bind().

Know — Composition API helpers and utilities

  • Helpers: useAttrs(), useSlots(), useModel() (the runtime behind defineModel), useTemplateRef() (3.5), useId() (3.5).
  • Utilities: isRef, unref, toRef, toValue (3.3), toRefs, isProxy, isReactive, isReadonly, isShallow.
  • Advanced: shallowRef, triggerRef, customRef, shallowReactive, shallowReadonly, toRaw, markRaw, effectScope, getCurrentScope, onScopeDispose.
  • Injection: provide, inject, hasInjectionContext() (3.3).

Know — Advanced APIs

  • Compile-time flags (set through the bundler's define): __VUE_OPTIONS_API__ (default true), __VUE_PROD_DEVTOOLS__ (false), __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ (false; enable to see mismatch details in production).
  • SSR: renderToString, renderToNodeStream, pipeToNodeWritable, renderToWebStream, pipeToWebWritable, renderToSimpleStream, useSSRContext(), data-allow-mismatch.
  • Custom elements: defineCustomElement(), useHost(), useShadowRoot(), this.$host. Render function: h, mergeProps, cloneVNode, isVNode, resolveComponent, resolveDirective, withDirectives, withModifiers. Custom renderer: createRenderer().

How it works

app/components/Docs/ApiMap.vue
<script setup lang="ts">
const raw = '{{ not compiled }}'
const el = useTemplateRef<HTMLDivElement>('box')
const id = useId()
const list = ref([{ id: 1, selected: false }])
</script>

<template>
  <!-- v-pre: children are not compiled; the mustaches render literally -->
  <span v-pre>{{ raw }}</span>

  <!-- v-bind modifiers: force a DOM property, force an attribute -->
  <my-element :value.prop="list" :data-id.attr="id" />

  <!-- v-memo with v-for must sit on the same element -->
  <div v-for="item in list" :key="item.id" v-memo="[item.selected]">
    {{ item.id }}
  </div>

  <!-- vue: prefix makes a native element render as a component (in-DOM templates) -->
  <table><tr is="vue:my-row" /></table>

  <div ref="box" v-once>{{ id }}</div>
</template>
vite.config.ts
export default defineConfig({
  define: {
    __VUE_OPTIONS_API__: 'false',                          // drop Options API support from the bundle
    __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true',       // debug mismatches in production builds
  },
})
Gotcha· v-memo on the wrong element

Inside v-for, v-memo must be on the same element as v-for; placing it on a child does nothing useful and the docs call this out. Its dependency array is the only thing compared, so leaving a value out means stale output.

Exercise

Exercise
  • Render {{ 1 + 1 }} inside v-pre and outside it; then write a v-cloak style and load an in-DOM template slowly to see it work.
  • Set __VUE_OPTIONS_API__ to false in a Vite project that has one Options API component and read the failure.
  • Use .prop to pass an object to a custom element and .attr to force an attribute; inspect the element in devtools.

Be able to say

Be able to say· What do v-pre, v-once, v-memo and v-cloak do?

"v-pre tells the compiler to skip the element and its children, so mustaches render literally, which is what you want for showing template syntax. v-once renders the element once and then treats it as static, skipping it in every later patch. v-memo takes an array of dependencies and skips updating the subtree unless one of them changed, and when combined with v-for it has to sit on the same element. v-cloak is an attribute Vue removes once compilation finishes; paired with a [v-cloak] { display: none } rule it hides un-compiled in-DOM templates until Vue is ready."

Your notes

Open in Notes

Nothing yet. Notes filed here show up on this page and the section overview.