Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reactive provide for the options API #2327

Closed
LifeIsStrange opened this issue Oct 7, 2020 · 4 comments
Closed

Allow reactive provide for the options API #2327

LifeIsStrange opened this issue Oct 7, 2020 · 4 comments

Comments

@LifeIsStrange
Copy link

What problem does this feature solve?

Feature parity between the options and the composition APIs.
Like many I am using what is arguably the most concise and ergonomic API for Vue3 which turns out to be Vue class component. e.g vuejs/vue-class-component#465
Vue class component I believe "transpile" to the Options API and anyway the Options API needs reactive provide inject too as most existing projects will keep using it just like react hooks does not deprecate in any ways their class API.

https://v3.vuejs.org/guide/component-provide-inject.html#working-with-reactivity
From my limited understanding, reactive dependency injection require the use of the Reactivity API which come from the composition API (but shouldn't ? ) such as Vue.computed(), ref(), etc.
It is unclear to me whether this reactivity API require to be used on setup() (composition) or if it can be used inside a class component or a standard option component without transforming the component into a full boilerplatey composition api.

What does the proposed API look like?

Allowing the existing required reactivity apis (Vue.computed(), etc) inside the options API thus allowing it too in Vue class components.

@posva
Copy link
Member

posva commented Oct 7, 2020

What is stopping you from doing what's said in the example you provided?

@edison1105
Copy link
Member

What is stopping you from doing what's said in the example you provided?

@posva this link is incorrect

@kleinfreund
Copy link
Contributor

@LifeIsStrange
Copy link
Author

@posva What is stopping you from doing what's said in the example you provided?
Well the documentation said we would need to assign a Composition API computed property to our provided todoLength
so I thougth the composition was not acessible in the options api (without setup) but actually I tried it and it's working fine.
The Vue class component Options api wrapper does not (yet ?) allow to access this and therefore cannot provide as of today which is a shame but this is not a vue-next issue I think.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants