Nowy standard. Twoje centrum tworzenia inteligentnego, szybkiego i zrównoważonego oprogramowania AI
Spis treści
Vue 3 replaced Vue 2’s Options-only component model with the Composition API and <script setup>, added Teleport, multi-root components and multiple v-model bindings, and removed filters and several Vue 2 APIs.
It was released in September 2020 and became the default version of Vue in February 2022. The latest stable release is Vue 3.5, and Vue 2 reached end of life on December 31, 2023.
For teams still running Vue 2 in production, the sections below show what changes, with Vue 2 and Vue 3 code side by side.
Executive Summary
Vue 3 is the only supported version of Vue: Vue 2 stopped receiving official security fixes at the end of 2023.
The biggest change is the Composition API, which lets teams organize and reuse logic by feature instead of by component option, with first-class TypeScript support.
Most other changes, such as fragments, Teleport, named
v-models and the removal of filters, are small in isolation, but together with Vue 2-only libraries they make migration a project that needs planning rather than a version bump.
Why Does Vue 3 Matter for Teams Still on Vue 2?
Vue 3 matters because Vue 2 is no longer maintained. The official end-of-life notice confirms that Vue 2 stopped getting updates, including security fixes, on December 31, 2023. Paid extended support exists (the notice points to HeroDevs’ Never-Ending Support), but that buys time rather than solving the problem.
The operational effect builds up slowly. Libraries drop Vue 2 support, new hires learn Vue 3 first, and security audits flag an unsupported framework. For products in regulated sectors such as healthcare or finance, that last point can block a compliance review on its own.
The tooling has moved on too. Vue CLI and Vuex are in maintenance mode. The official docs recommend Vite (through create-vue) and Pinia for new projects. Staying on Vue 2 means staying on a toolchain that won’t get new features.
What Is the Composition API in Vue 3?
The Composition API is a set of functions (ref, reactive, computed, watch and lifecycle hooks) that let you organize component code by logical concern instead of by component option. It is optional: the Options API (data, methods, computed) is still fully supported in Vue 3.
In Vue 2, code was grouped by option type, so one feature’s logic ended up spread across data, methods and computed. As components grew, they became hard to read and maintain. Vue 2 offered three ways to reuse logic between components, and each had a real cost:
Vue 2 reuse method | What it does well | Main problem |
|---|---|---|
Mixins | Groups code by feature | Property name conflicts; unclear where a property comes from |
Mixin factories | Mixins configurable through a function | Implicit properties; namespacing relies on team conventions |
Scoped slots | Avoids most mixin problems | Configuration lives in the template; extra component instances and nesting |
Here’s a Vue 2 component using the Options API and a mixin:
<template>
<div id="app">
<h1>{{ title }}</h1>
<input type="text" v-model="inputVal" />
<button @click="addTitle">Add</button>
<button @click="clearInput">Clear</button>
<button @click="pressMe">Show info</button>
</div>
</template>
<script>
const exampleMixin = {
data() {
return { someInfo: "This is our mixin!" };
},
methods: {
pressMe() {
alert(this.someInfo);
}
}
};
export default {
mixins: [exampleMixin],
data() {
return { inputVal: "", title: "" };
},
methods: {
clearInput() {
this.inputVal = "";
},
addTitle() {
this.title = this.inputVal;
}
}
};
</script>The same component in Vue 3, with <script setup> and a composable replacing the mixin:
<script setup>
import { ref } from "vue";
import { useInfo } from "./useInfo"; // a composable: a plain function returning refs and functions
const inputVal = ref("");
const title = ref("");
const { pressMe } = useInfo("This is our composable!");
function clearInput() {
inputVal.value = "";
}
function addTitle() {
title.value = inputVal.value;
}
</script>
<template>
<div id="app">
<h1>{{ title }}</h1>
<input type="text" v-model="inputVal" />
<button @click="addTitle">Add</button>
<button @click="clearInput">Clear</button>
<button @click="pressMe">Show info</button>
</div>
</template><script setup> (stable since Vue 3.2) removes the setup() boilerplate: everything declared at the top level is available in the template. Unlike a mixin, the composable makes it explicit where pressMe comes from, and it can take arguments to configure it.
The Composition API also brings better TypeScript inference, since Vue 3 itself is written in TypeScript and composables are plain typed functions. The trade-off is the learning curve: developers need to understand ref vs reactive, .value access, and why destructuring a reactive object breaks reactivity. You don’t need to rewrite working Options API components to benefit from Vue 3; many teams use the Composition API only for new or shared logic.
Which Component and Template Features Are New in Vue 3?
What Is Teleport in Vue 3?
Teleport renders part of a component’s template into a different place in the DOM, outside the component’s own element. It’s built for modals, notifications and dialogs, which need to sit at the top of the DOM for positioning and z-index to work, while their logic stays in the component that opens them.
The to prop takes a CSS selector for the target:
<teleport to="#modals">
<div class="modal">Foo</div>
</teleport>
<teleport to="#modals">
<div class="modal">Bar</div>
</teleport>Both blocks render into the same target, in order:
<div id="modals">
<div class="modal">Foo</div>
<div class="modal">Bar</div>
</div>The target element has to exist when the Teleport mounts. Since Vue 3.5, the defer prop lets you target an element that Vue renders later in the same mount, which removes a common source of “target not found” errors.
Can a Vue 3 Component Have Multiple Root Elements?
Yes. Vue 3 supports fragments, so a component template can have several root nodes. In Vue 2, a template with more than one root element failed to compile, so every component needed a wrapper <div>.
Vue 2:
<template>
<div>
<header></header>
<section></section>
</div>
</template>Vue 3:
<template>
<header></header>
<section></section>
</template>With multiple roots, Vue no longer knows where to put attributes passed from the parent, such as class. You decide by binding $attrs to one of the root elements.
How Do Multiple v-models Work in Vue 3?
Vue 3 lets you bind several v-models to one component by giving each a name. Vue 2 allowed a single v-model per component, so binding more than one value meant using the .sync modifier or passing a whole object.
Vue 2:
<exampleForm v-model="person" />Vue 3:
<exampleForm v-model:age="person.age" v-model:name="person.name" />Since Vue 3.4, the child component can declare each binding with the defineModel() macro instead of writing a prop and an update: event by hand:
<script setup>
const age = defineModel("age");
const name = defineModel("name");
</script>
<template>
<input v-model="name" />
<input v-model.number="age" type="number" />
</template>What Changed in Component Events and Async Components?
Components now declare the events they emit in an emits option (or with defineEmits() in <script setup>), the same way they declare props. This documents the component’s API and lets Vue separate component events from native listeners.
Async components must be wrapped in defineAsyncComponent:
// Vue 2
const AsyncComponent = () => import("./AsyncComponent.vue");
// Vue 3
import { defineAsyncComponent } from "vue";
const AsyncComponent = defineAsyncComponent(() => import("./AsyncComponent.vue"));Lazy-loaded routes in Vue Router don’t need the wrapper; plain dynamic imports still work there.
What Is Suspense in Vue 3?
<Suspense> is a built-in component that shows fallback content, such as a spinner, while async components or async setup() functions in its tree are resolving:
<Suspense>
<template #default>
<DashboardWithAsyncData />
</template>
<template #fallback>
Loading...
</template>
</Suspense>Suspense is still marked as experimental in the official docs, and its API may change. It’s fine for prototypes and internal tools, but we wouldn’t build core production flows around it yet.
What Was Removed or Renamed in Vue 3?
Why Were Filters Removed in Vue 3?
Filters were removed because they duplicated what computed properties and methods already do, and they needed custom syntax inside templates. Replace them with a computed property, or with a plain function for formatting you reuse across components.
Vue 2:
<template>
<span>{{ amount | usd }}</span>
</template>
<script>
export default {
data() {
return { amount: 10 };
},
filters: {
usd(val) {
return val + "$";
}
}
};
</script>Vue 3:
<script setup>
import { ref, computed } from "vue";
const amount = ref(10);
const usd = computed(() => amount.value + "$");
</script>
<template>
<span>{{ usd }}</span>
</template>Which Lifecycle Hooks Changed in Vue 3?
Two Options API hooks were renamed: destroyed is now unmounted, and beforeDestroy is now beforeUnmount. In the Composition API, each hook has an on… equivalent that you call inside setup() or <script setup>:
Options API | Composition API |
|---|---|
beforeCreate | Not needed (use |
created | Not needed (use |
beforeMount | onBeforeMount |
mounted | onMounted |
beforeUpdate | onBeforeUpdate |
updated | onUpdated |
beforeUnmount | onBeforeUnmount |
unmounted | onUnmounted |
errorCaptured | onErrorCaptured |
renderTracked | onRenderTracked |
renderTriggered | onRenderTriggered |
How Does Styling Work in Vue 3 Single-File Components?
How Do You Use v-bind() in Vue 3 CSS?
Vue 3 lets you bind component state directly to CSS values with v-bind() inside the <style> tag. It’s been stable since Vue 3.2. Vue compiles it to a CSS custom property that updates when the state changes, so you no longer need inline :style bindings for dynamic values.
<script setup>
import { ref, computed } from "vue";
const showModal = ref(false);
const shadowDisplay = computed(() => (showModal.value ? "block" : "none"));
</script>
<template>
<button @click="showModal = !showModal">Toggle modal</button>
<div v-if="showModal" class="modal">Modal window</div>
<div class="shadow"></div>
</template>
<style scoped>
.shadow {
display: v-bind(shadowDisplay);
position: fixed;
inset: 0;
background: rgb(46 46 46 / 31%);
}
</style>What Changed in Scoped Styles in Vue 3?
Scoped styles still apply only to the current component, but the selectors for reaching outside it changed:
The
>>>and/deep/combinators are deprecated. Use the:deep()pseudo-class to style child components.Scoped styles no longer affect slot content by default. Use
:slotted()to target it.Use
:global()for a single global rule instead of adding a second, unscoped<style>block.
What Has Been Added Since Vue 3.0?
Vue 3 has kept evolving through minor releases, so “Vue 3” in 2026 is a different developer experience from the 3.0 release in 2020. These are the additions most teams use:
Vue 3.2 (2021):
<script setup>andv-bind()in CSS became stable.Vue 3.3 (2023): generic components and imported types in
defineProps, which made TypeScript in SFCs much less awkward.Vue 3.4 (2023):
defineModel()became stable, and a rewritten template parser made compilation faster.Vue 3.5 (2024): reactive props destructure became stable, along with
useTemplateRef(),useId()for SSR-safe IDs, lazy hydration for async components and deferred Teleport. The release also reworked the reactivity system to use less memory.
Vue 3.6 is in release candidate as of November 2026. Its headline feature is Vapor Mode, an opt-in compilation mode that renders components without the virtual DOM for better performance. Treat it as something to test, not to build on, until it ships as stable.
Vue 2 vs Vue 3: What Are the Key Differences?
Vue 2 | Vue 3 | |
|---|---|---|
Support status | End of life since December 31, 2023 | Actively maintained (3.5 stable, 3.6 in RC) |
Component logic | Options API | Options API and Composition API, |
Logic reuse | Mixins, mixin factories, scoped slots | Composables |
Root elements | One | Multiple (fragments) |
| One (plus | Multiple, named; |
Filters | Supported | Removed |
TypeScript | Limited, via add-ons | Built in TypeScript, full inference |
Recommended tooling | Vue CLI, Vuex | Vite ( |
What Should You Watch Out For When Migrating from Vue 2 to Vue 3?
The hardest part of a Vue 2 to Vue 3 migration is usually the ecosystem, not your own components. UI libraries, plugins and older internal packages that only support Vue 2 often have to be upgraded or replaced first, and that work is hard to estimate until you audit your dependencies.
The official migration build (@vue/compat) helps by running Vue 3 with Vue 2 behavior switchable per feature, so you can fix deprecation warnings step by step. For large apps, upgrading to Vue 2.7 first is a useful intermediate step, since it backports the Composition API and <script setup>. Vuex to Pinia and Vue CLI to Vite are separate migrations; plan them as their own steps rather than one big-bang release.
If the app is small, rarely changes and is due for replacement, a full migration may not be worth it. Paid extended support can be the cheaper option there, as long as you have a date for retiring the app.
Key Takeaways
Vue 2 has been end of life since December 31, 2023; Vue 3.5 is the current stable line.
The Composition API and
<script setup>let you organize code by feature and replace mixins with typed composables.The Options API still works in Vue 3, so you don’t have to rewrite working components.
Fragments, Teleport, named
v-models anddefineModel()remove common Vue 2 workarounds.Migration effort depends mostly on Vue 2-only dependencies; audit them first and use the migration build.
Is It Time to Move Your Product to Vue 3?
For anything you plan to keep developing, yes: Vue 3 is where security fixes, tooling and hiring are, and the Composition API makes large codebases easier to maintain. What makes a migration go well is a full dependency audit, an incremental plan and tests that catch regressions before your users do.
Monterail is an official Vue.js partner. Our Vue.js development team has done this kind of migration before. For Systems Engineering, we moved a large TypeScript application from Vue 2 to Vue 3 as part of a long-term partnership. If you’re planning a migration or a new Vue product, let’s talk about your project.
Vue 3 Features FAQ



)

