Options API (Vue 2 style): tổ chức code theo loại (data, methods, computed, watch).
Composition API (Vue 3): tổ chức code theo logic concern, dùng setup() hoặc <script setup>.
- Composition API dễ tái sử dụng logic hơn qua composables
- TypeScript support tốt hơn trong Composition API
- Options API vẫn được hỗ trợ đầy đủ trong Vue 3
Khuyến nghị dùng Composition API với <script setup> cho project mới.
Options API (Vue 2 style): organizes code by type (data, methods, computed, watch).
Composition API (Vue 3): organizes by logic concern using setup() or <script setup>.
- Composition API enables better logic reuse via composables
- Better TypeScript support in Composition API
- Options API is still fully supported in Vue 3
Recommended: Composition API with <script setup> for new projects.