Add Composition API Support #691
Replies: 2 comments
-
Hi Oliver, Unfortunately, we don't support the composition API on Vue 2, and don't really intend to do so going forward either. The reason for it is pretty simple: It would increase the complexity and maintenance burden of the Vue 2 adapter quite a bit, without really adding a lot of value. Instead, in those cases, we recommend to either use Vue 3 directly, or to use Vue 2's options API instead. While this might not be your preferred approach for Vue 3, it is totally backwards-compatible and allows for a gradual transition from the options API to the composition API. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Any plans to change this now that Vue 2.7+ supports the Composition API out of the box? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Versions:
@inertiajs/inertia
version: 0.8.7@inertiajs/inertia-vue
version: 0.5.12Describe the problem:
I'm trying to access the page attribute while using the Composition API with Vue 2. Inertia for Vue 3 seems to have a
usePage
method which is ideally what I need here. I've tried using thegetCurrentInstance()
method of the Composition API module but the page attribute is undefined there. I can access withcontext.root.$pages
, which isn't the end of the world but it requires I passcontext
to every composable I need it in.Eventually I will be converting the whole project to Vue 3 and the Composition API, but it would be nice to not have to do this workaround during the transition.
Steps to reproduce:
Use Vue 2 with the
@vue/composition-api
module installed.Beta Was this translation helpful? Give feedback.
All reactions