
Migration Vue 2→3 & Nuxt 2→3
Options API to Composition API, Vuex to Pinia, asyncData/fetch to useFetch, breaking changes, migration strategies, nuxtServerInit deprecation
1What is the main architectural difference between Vue 2's Options API and Vue 3's Composition API?
What is the main architectural difference between Vue 2's Options API and Vue 3's Composition API?
답변
The Composition API organizes code by logical concern rather than by option type, allowing related code to be grouped together. This approach improves readability and maintainability of complex components, unlike the Options API which separates data, methods, and computed properties. The Composition API also facilitates logic reuse through composables, effectively replacing mixins that could create naming conflicts.
2What major change did Nuxt 3 introduce regarding auto-imports compared to Nuxt 2?
What major change did Nuxt 3 introduce regarding auto-imports compared to Nuxt 2?
답변
Nuxt 3 enables auto-imports by default for composables, components, and framework utilities, eliminating the need for manual imports. This feature improves developer experience and reduces boilerplate code. Nuxt 2 required explicit imports for most functionalities. This feature can be disabled in the configuration if needed for explicit control reasons.
3In Vue 3, what method replaces Vue 2 filters that have been removed?
In Vue 3, what method replaces Vue 2 filters that have been removed?
답변
Filters were removed in Vue 3 because they created custom syntax that was difficult for new developers to understand and impacted performance. The official recommendation is to use computed properties or methods for data transformations. Computed properties offer the advantage of automatic caching for expensive calculations, while methods are suitable for simple transformations with parameters.
What is the default build tool in Nuxt 3, replacing Nuxt 2's Webpack?
How did the v-model syntax change between Vue 2 and Vue 3 for custom components?
+19 면접 질문