Vue.js Reference
|
This section documents the current Vue 3.x release line as published at
the official Vue.js documentation, which is the reference these pages are written and
verified against. No specific patch version is pinned. The Composition API with This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production, since Vue and its ecosystem iterate quickly. This section’s bibliography lists the reference material consulted while preparing these pages. |
Welcome to the Vue.js reference. Vue.js is a progressive JavaScript framework for building
user interfaces: you describe the UI declaratively as a tree of components, and Vue’s reactivity system keeps
the DOM in sync with the state each component reads. This section documents the current Vue 3.x release
line, using the Composition API with <script setup> throughout (the Options API appears only as a
labelled contrast), written and verified against the official documentation.
If you are new to Vue, start with Getting Started and Template Syntax, then Reactivity Fundamentals and Components Basics, then work down the list or jump to what you need.
What’s covered
Essentials
-
Getting Started — what Vue is, the progressive framework, the SFC shape, the Options and Composition API styles, the ways of using Vue, and
createApp/app.mount/app.config. -
Template Syntax — text interpolation and
v-html, attribute bindings withv-bind, directive arguments and modifiers, the:/@/#shorthands, and dynamicclassandstylebindings. -
Reactivity Fundamentals —
ref()andreactive(), ref unwrapping and thereactivecaveats,toRefs/toRef,nextTick, and how the track / trigger dependency system works under the hood. -
Computed Properties —
computed(), caching versus methods, writable computed withget/set, andcomputedversuswatch. -
Conditional and List Rendering —
v-if/v-else/v-show,v-forover arrays, objects and ranges, thekeyrequirement, and thev-if+v-forprecedence trap. -
Event Handling —
v-on/@, inline versus method handlers, and the event, key and mouse-button modifiers. -
Form Input Bindings —
v-modelon text, checkbox, radio and select inputs, what it desugars to, and the.lazy/.number/.trimmodifiers. -
Watchers —
watchandwatchEffect,deep/immediate/once, callback flush timing, andonWatcherCleanup. -
Template Refs —
useTemplateRef()and therefattribute, refs inv-for, function refs, and component refs withdefineExpose(). -
Lifecycle Hooks — the lifecycle diagram, registering hooks in
setup, and the Options API equivalents. -
Components Basics — defining and registering components, passing props, listening to events, a first look at slots, and dynamic components.
Components in depth
-
Registration and Props — global versus local registration,
defineProps()runtime and type-based declaration, prop validation, one-way flow, and reactive props destructure. -
Component Events and v-model —
defineEmits()and declared events,defineModel(),v-modelarguments and modifiers, and fallthrough attributes with$attrsandinheritAttrs. -
Slots — default, named and scoped slots, the
#shorthand, conditional and dynamic slot names, and the renderless component pattern. -
Provide / inject —
provide/inject, app-level provide, typed injection keys, and keeping provided values reactive. -
Async Components —
defineAsyncComponent, the loading and error states, and pairing with route-level code splitting and<Suspense>.
Reusability
-
Composables — extracting stateful logic into
use*functions, the conventions, side-effect cleanup, and composables versus mixins. -
Custom Directives and Plugins — the directive hooks and binding object, and the plugin
installcontract withapp.use().
Built-in components and animation
-
Transitions and Animation —
<Transition>and its classes and JavaScript hooks,<TransitionGroup>and move transitions, state-driven animation, GSAP, and route transitions. -
KeepAlive, Teleport and Suspense —
<KeepAlive>caching,<Teleport>,<Suspense>, and the special elements and attributes.
Scaling up
-
Single-File Components — the SFC blocks,
<script setup>and its compiler macros, generics, and the scoped-CSS / CSS-Modules /v-bind()style features. -
Tooling and Project Setup —
create-vueand Vite, Vue Language Tools,eslint-plugin-vue,vue-tsc, and the Vue DevTools. -
Routing — Vue Router setup,
<RouterView>/<RouterLink>, dynamic and nested routes, navigation guards, and lazy-loaded route components. -
State Management — the reactivity-API simple store and Pinia’s setup and option stores,
state/getters/actions, andstoreToRefs. -
Testing — the testing pyramid, Vitest and Vue Test Utils, testing composables, router and Pinia, snapshot testing, and end-to-end tests with Cypress / Playwright.
-
Server-Side Rendering — CSR versus SSR versus SSG,
createSSRAppandrenderToString, hydration and mismatches, and Nuxt.
TypeScript
-
Vue with TypeScript — project setup, typing
ref/reactive/computed, type-baseddefineProps/defineEmits/defineModel, typed template refs and injection keys, generic components, and the Options API side.
Under the hood
-
Rendering, Render Functions and Web Components — the virtual DOM and render pipeline, compiler-informed fast paths,
h()and JSX, functional components, anddefineCustomElement().
Best practices
-
Performance and Deployment — profiling, page-load and update optimizations, production feature flags, error tracking, and worked deployments to Netlify and AWS.
-
Security and Accessibility — Vue’s HTML-escaping and the
v-htmlrisk, injection sinks, semantic templates, route-change focus management, and testing tools. -
Style Guide and Best Practices — the official Style Guide priority levels, component-design guidance, and the Composition API rationale.
-
UI Component Libraries — how to style a Vue app and which ready-made component libraries to reach for, free and open-source first (Vuetify, PrimeVue, Element Plus, Naive UI, Quasar, Nuxt UI, Reka UI, …), with commercial suites and accessibility last.
Reference
-
Cheat sheet — a one-page, downloadable PDF summary of the essentials above for quick memorization.
Bibliography
-
vuejs.org — the official Vue.js documentation, the source every page in this section is written and verified against; call out the Guide (Essentials, Components In-Depth, Reusability, Built-in Components, Scaling Up, Best Practices, TypeScript, Extra Topics), the API reference, the Style Guide, Examples, the SFC Playground, the blog, and the Vue 2 to 3 migration guide.
-
Official ecosystem documentation cited in this section: Vue Router, Pinia, Vite, create-vue, Vue DevTools, Vitest, Vue Test Utils, eslint-plugin-vue, Nuxt, VitePress, Vuetify, PrimeVue, Element Plus, Naive UI, Quasar, Reka UI, Nuxt UI, Headless UI, and VueUse.
-
MDN Web Docs — for the web-platform APIs Vue builds on (the DOM, events,
fetch, custom elements and the Shadow DOM, the History API), cross-linked from the pages that use them, together with the existing JavaScript Development and TypeScript Reference sections on this site. -
Cuomo, Simone. Vue.js 3 for Beginners — Learn the essentials of Vue.js 3 and its ecosystem to build modern web applications. Packt Publishing, 2024. ISBN 978-1-80512-677-5. Consulted as part of the bibliography for this section (a project/tutorial book that predates parts of the current release line; not the primary or main reference) — see the publisher’s book page, packtpub.com, the O’Reilly listing, and the companion code repository.
-
Quinten, Joran. Building Real-World Web Applications with Vue.js 3 — Build a portfolio of Vue.js and TypeScript web applications to advance your career in web development. Packt Publishing, 2024. ISBN 978-1-83763-039-4 (print), 978-1-83763-282-4 (ebook). Consulted as part of the bibliography for this section (a project/tutorial book that predates parts of the current release line; not the primary or main reference) — see the publisher’s book page, packtpub.com, the O’Reilly listing, and the companion code repository.
-
Shavin, Maya; Camden, Raymond; Gurney, Clifford; Di Francesco, Hugo. Frontend Development Projects with Vue.js 3 — Learn the fundamentals of building scalable web applications and dynamic user interfaces with Vue.js, 2nd ed. Packt Publishing, 2023. ISBN 978-1-80323-499-1 (print), 978-1-80323-631-5 (ebook). Consulted as part of the bibliography for this section (a project/tutorial book that predates parts of the current release line; not the primary or main reference) — see the publisher’s book page, packtpub.com, the O’Reilly listing, and the companion code repository.