Vue 3 Introduction
Vue 3 is a progressive framework for building user interfaces.
Progressive means you can introduce only a part of Vue's capabilities as your project needs: from a simple page interaction enhancement, to building a complete single-page application (SPA), and even server-side rendering (SSR) applications—Vue 3 can handle them all.
Vue 3 is a progressive JavaScript front-end framework led by Evan You, officially released on September 18, 2020, codenamed One Piece.
Compared with Vue 2, Vue 3 underwent a comprehensive rewrite of its core architecture: the reactivity system changed from Object.defineProperty to Proxy, introduced the Composition API, and achieved overall improvements in performance, TypeScript support, and bundle size.

Vue 3's official positioning is:a framework that is easy to get started with while being capable enough to support complex projects. It neither enforces a specific architecture like Angular, nor requires a lot of manual optimization like React; instead it finds a balance between usability and capability.
The Essential Difference Between Vue 3 and Vue 2
Vue 3 is not a patch upgrade of Vue 2, but a complete rewrite.
| Comparison Item | Vue2 | Vue3 |
|---|---|---|
| Reactivity Principle | Object.defineProperty, unable to detect newly added properties and array index changes |
Proxy, fully proxies all operations on objects, with none of the above limitations |
| Code Organization | Options API: data, methods, and computed are separated | Composition API: code is aggregated by logical concern |
| TypeScript Support | Adapted later, with limited type inference | Core code rewritten in TypeScript; TS is a first-class citizen |
| Bundle Size | About 20KB runtime (gzip) | Supports Tree-shaking and on-demand bundling; minimum is only 13.5KB |
| Performance | Baseline | Initial render about 55% faster, update render about 133% faster, and memory usage reduced by about 54% |
| Component Template Root Node | Must have one and only one root element | Supports multiple root nodes (Fragment) |
| Global API | Mounted on the Vue constructor; multiple instances share state | Pass createApp Creates independent instances with more thorough isolation |
Core Features
Vue 3's improvements cover four dimensions: the reactivity system, API design, the compiler, and new built-in components.
Composition API
The Composition API is the most important design change in Vue 3; it solves the fundamental pain point of the Options API in Vue 2:Related logic is scattered across different options, making reuse difficult.
In the Options API, the data for a "user search" feature may be scattered across data, methods, computed, watch four options; whereas the Composition API lets you write all the logic of the same feature together, then extract it into a reusable function (Composable).
Example: Options API vs Composition API
Example: Recommended approach (script setup syntax sugar)
User: {{ username }}
Count: {{ count }}, doubled: {{ doubled }}
+1
is the syntax sugar of the Composition API: it lets you writeComposition API code directly at the top level, without manuallyreturn, and all top-level variables and functions are automatically exposed to the template. This is currently the most recommended way to write Single File Components in Vue 3.
Reactivity System: Proxy instead of defineProperty
Vue 2's reactivity is based on Object.defineProperty, which has two incurable problems: it cannot detect newly added object properties, and cannot detect direct index assignment to arrays. Vue 3 uses Proxy to fundamentally solve these two problems.
Example: ref and reactive
import
{
ref
,
reactive
,
watch
}
from
'vue'
// ref: suitable for primitive types (number, string, boolean)
// accessing and modifying the value requires .value
const
count
=
ref
(
0
)
count.
value
=
10
// reactive: suitable for objects and arrays
// access properties directly, no .value needed
const
user
=
reactive
(
{
name
:
'RUNOOB'
,
age
:
18
,
skills
:
[
'vue'
,
'typescript'
]
}
)
// Vue 3 can directly add new properties to objects, and reactivity works normally
user.
=
'runoob@example.com'
// in Vue 2 this operation does not trigger a view update
// can also directly modify array elements
user.
skills
[
0
]
=
'vue3'
// in Vue 2 this operation does not trigger a view update
// watch reactive data changes
watch
(
count
,
(
newVal
,
oldVal
)
=>
{
console.
log
(
`count changed from $
{
oldVal
}
to $
{
newVal
}
`
)
}
)
Composables
Composables are the standard way to reuse stateful logic in Vue 3, similar to React's custom Hooks.
By convention, named with use as a prefix, extracting a complete piece of reactive logic into an independent function that is reused across multiple components.
Example: Custom Composable
// file path: composables/useCounter.js
// encapsulates counter logic, reusable by any component
import
{
ref
,
computed
}
from
'vue'
export
function
useCounter
(
initialValue
=
0
)
{
const
count
=
ref
(
initialValue
)
// internal reactive state
const
doubled
=
computed
(
(
)
=>
count.
value
2
)
// derived state
function
increment
(
)
{
count.
value
++
}
function
decrement
(
)
{
count.
value
--
}
function
reset
(
)
{
count.
value
=
initialValue
}
// returns the state and methods to be exposed externally
return
{
count
,
doubled
,
increment
,
decrement
,
reset
}
}
Example: Using a Composable in a component
Current value: {{ count }}, doubled: {{ doubled }}
+1
-1
Reset
New Built-in Components
Vue 3 added three built-in components, solving three categories of high-frequency scenarios in front-end development.
| Component | Problem Solved | Typical Use Case |
|---|---|---|
| Fragment | Vue 2 required a component template to have a single root node; Fragment allows multiple root nodes to coexist (no extra wrapping div needed) | List item components, reducing unnecessary DOM nesting |
| Teleport | Renders a component's HTML to any specified position in the DOM, breaking through the parent component's CSS stacking context limitation | Global Modal dialogs, Toast notifications, floating toolbars |
| Suspense | Gracefully displays fallback content before an async component finishes loading, unifying the handling of async waiting states | Skeleton screens for lazily loaded components, and Loading during route switches |
Example: Teleport for global modals
Open modal
This is a global modal
Close
Example: Suspense handling async component loading
Loading...
Tree-shaking Support
Vue 3 changed all global APIs to named exports, working with the tree-shaking capability of bundlers like Vite / webpack, so unused APIs are not bundled into the final output.
Example: Import APIs on demand
// Vue 2: all APIs accessed via the global Vue object, cannot be tree-shaken
// Vue.nextTick(...)
// Vue.set(obj, 'key', value)
// Vue 3: import on demand; the bundle only includes the functions actually used
import
{
ref
,
computed
,
watch
,
nextTick
,
onMounted
}
from
'vue'
// only these APIs are imported; the rest that are unused (such as watchEffect, provide, etc.) will not enter the output
Lifecycle Hooks
The lifecycle hooks of Vue 3's Composition API all begin with on and are called inside the setup function.
| Vue 2 Options API | Vue 3 Composition API | Trigger Timing |
|---|---|---|
beforeCreate |
- (setup itself replaces it) | Before instance initialization |
created |
- (setup itself replaces it) | Instance created |
beforeMount |
onBeforeMount |
Before mount |
mounted |
onMounted |
Mounted, DOM accessible |
beforeUpdate |
onBeforeUpdate |
Before data update / DOM re-render |
updated |
onUpdated |
After DOM re-render complete |
beforeDestroy |
onBeforeUnmount |
Before component unmount (name changed) |
destroyed |
onUnmounted |
After component unmount complete (name changed) |
Example: Using lifecycle hooks
Running: {{ count }} seconds
Full TypeScript Support
Vue 3's core library is completely rewritten in TypeScript, providing precise type inference. Combined with , you can use TypeScript directly in Single File Components without extra configuration.
Example: Using TypeScript in script setup
Application Areas
As a complete front-end framework ecosystem, Vue 3 covers a wide range of scenarios from single-page applications to server-side rendering, and from Web to mobile.
Single-page application (SPA)
This is the most classic use case for Vue 3. With Vue Router 4 for front-end routing and Pinia (Vue 3's officially recommended state management library, replacing Vuex) for global state, you can build fully functional single-page applications.
Typical project types: enterprise back-office management systems, data dashboards, and e-commerce platform front ends.
Server-Side Rendering (SSR) and Static Site Generation (SSG)
Nuxt 3 is a full-stack framework based on Vue 3, deeply integrating SSR and SSG capabilities. It automatically handles the complexity of server-side rendering, letting developers build SEO-friendly applications just like writing ordinary Vue components.
Suitable for: content websites, blogs, documentation sites, and marketing landing pages.
Mobile and Cross-Platform
uni-app supports developing WeChat Mini Programs, Alipay Mini Programs, H5, and Apps (iOS/Android) simultaneously using Vue 3 syntax. Ionic + Vue 3 is suitable for building high-quality hybrid mobile apps.
Desktop Applications
Electron + Vue 3 (via toolchains like electron-vite) can package Vue 3 apps into cross-platform desktop programs. Tauri + Vue 3 is a popular alternative in recent years, using Rust as the backend for smaller app size and better performance.
UI Component Library Ecosystem
The Vue 3 ecosystem offers a rich selection of mature component libraries:
| Component Library | Locate | Applicable scenarios |
|---|---|---|
| Element Plus | A PC desktop component library, the Vue 3 version of Element UI | Enterprise back-office management, data-intensive applications |
| Ant Design Vue | The Vue implementation of Ant Design, with a mature design specification | Mid-to-back-office systems, enterprise applications |
| Vant 4 | A mobile component library, lightweight and high-performance | Mobile H5, WeChat Mini Programs |
| Vuetify 3 | A Material Design style component library | Consumer-facing web applications |
| Naive UI | Written in TypeScript, with strong theme customization capabilities | Projects requiring deep theme customization |
| shadcn-vue | Component sets based on Radix UI and Tailwind, with copy-paste code | Projects emphasizing UI uniqueness |
Development History
Vue.js grew from a personal project into one of the world's top three front-end frameworks, with every major version driven by clear engineering needs.
Origins (2013 - 2014)
Vue.js was created by Evan You while working at Google. In 2013, he explored the developer experience of Angular, hoping to extract his favorite parts—the data-driven view update mechanism—while removing what he considered overly heavy.
In February 2014, Vue.js 0.8.0 was publicly released, and subsequently gained attention from the Laravel community, gradually becoming well-known in the JavaScript community.
The Vue 1.x Era (2015)
In October 2015, Vue 1.0 was officially released, codenamed Evangelion. In the same year, Vue Router (2015.08), Vuex (2015.11), and Vue CLI (2015.12) were released successively, marking Vue's evolution from a view-layer library into a complete progressive framework.
The Vue 2.x Era (2016 - 2020)
In October 2016, Vue 2.0 was released, introducing a virtual DOM approach (inspired by React), supporting server-side rendering (SSR), with significantly improved performance.
The Vue 2 era was the period of fastest ecosystem expansion: component libraries like Element UI emerged, Nuxt.js appeared, and Vue became one of the front-end frameworks with the most GitHub stars worldwide.
In February 2019, Vue 2.6 was released, codenamed Macross; this was the last major version of Vue 2, bridging the past and the future.
Vue 3.0 Released (2020)
Development of Vue 3 began at the end of 2018 and took about two years, going through 30+ RFCs (Request for Comments), 2600+ commits, and 628 PRs from 99 contributors.
On September 18, 2020, Vue 3.0 was officially released, codenamed One Piece. Core changes:
- The reactivity system is based on
Proxyrewritten - Introduced the Composition API
- Full TypeScript support
- Added Fragment, Teleport, Suspense
- Supports Tree-shaking, significantly reducing bundle size
Ecosystem Maturation Phase (2021 - 2022)
| Time | Version / Event | Milestone Significance |
|---|---|---|
| 2021-08 | Vue 3.2 | The syntax sugar became officially stable, |