Nâng CaoVue.js iconVue.js

Vue 3 vs Vue 2 — những thay đổi lớn nhất?

Vue 3 mang lại nhiều cải tiến căn bản về API và performance so với Vue 2.

  1. Composition API + <script setup> — thay thế Options API (vẫn supported)
  2. Reactivity dùng Proxy thay Object.defineProperty — detect thêm/xóa property
  3. Fragments, Teleport, Suspense — component mới
  4. Multiple v-model trên component
  5. createApp() thay new Vue() — tách instance tốt hơn
  6. TypeScript support tốt hơn
  7. Vue CLI (Webpack-based) bị deprecated; scaffolding hiện tại (npm create vue@latest) dùng Vite
  8. Pinia thay Vuex
  9. Bundle nhỏ hơn nhờ tree-shaking tốt hơn
  10. v-if ưu tiên hơn v-for (ngược Vue 2)

Xem toàn bộ Vue.js cùng filter theo level & chủ đề con.

Mở danh sách Vue.js