Vue Composition API
lastmod 2026-11-10created 2021-09-272 edits
Vue Composition API is a set of Vue APIs for writing component logic by composing functions such as ref, reactive, computed, and watch inside a setup function instead of an options object. It is built into Vue 3, and in Vue 2 the same approach can be used by installing the @vue/composition-api plugin. Its differences from the Options API are that related logic can be grouped by feature and reused more easily, and that it works better with TypeScript inference.
Composition API plugin for Vue 2