Vue 3 mang lại nhiều cải tiến căn bản về API và performance so với Vue 2.
- Composition API +
<script setup>— thay thế Options API (vẫn supported) - Reactivity dùng Proxy thay Object.defineProperty — detect thêm/xóa property
- Fragments, Teleport, Suspense — component mới
- Multiple v-model trên component
createApp()thaynew Vue()— tách instance tốt hơn- TypeScript support tốt hơn
- Vue CLI (Webpack-based) bị deprecated; scaffolding hiện tại (
npm create vue@latest) dùng Vite - Pinia thay Vuex
- Bundle nhỏ hơn nhờ tree-shaking tốt hơn
- v-if ưu tiên hơn v-for (ngược Vue 2)
Vue 3 brings fundamental API and performance improvements over Vue 2.
- Composition API +
<script setup>replacing Options API (still supported) - Reactivity uses Proxy instead of Object.defineProperty — detects property additions/deletions
- Fragments, Teleport, Suspense — new components
- Multiple v-models on components
createApp()replacingnew Vue()— better instance isolation- Better TypeScript support
- Vue CLI (Webpack-based) is deprecated; the current official scaffolding (
npm create vue@latest) uses Vite - Pinia replacing Vuex
- Smaller bundles via better tree-shaking
v-ifnow has higher priority thanv-for(opposite of Vue 2)