-
Notifications
You must be signed in to change notification settings - Fork 429
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
Vue 3.0 full state with classes and annotations. #459
Comments
Thanks for posting your idea but it looks too broad and vague to make changes for Vue Class Component. As stated in contribution guideline, you should mention use cases or problems you want to solve for each feature request to verify if the feature is really worth adding and benefits the most of people. As for the next major version, there are threads to discuss particular use cases and you can comment in the threads. You also can create a new issue if your use case is not covered in the existing thread for a feature request. Please make sure to make your issue precise and specific with a concrete use case to solve. Thank you. |
@ktsn Sorry If I posted this as an all. I published this no to make a pull request or change the current code, if not then to show another perspective of Vue with classes and showing that it is possible. When I saw Vue 3.0 and Composition API by first time, I love it, because It separate the magic reactiviness with controllers(components), and now we can use reactiveness independently from components. And for example I can make a reactive service(test it as simple service class not as vue component) and only import it in a setup function exposing what is important in the view. I was very unhappy when Vue decided to don't give support to classes, but after I see that it was the best choose because give us a lot of flexibility to make many architectures on the top of vue. I came to see if the vue classes is already supported but I found that is not already and I think is loosing some of simplicity of what Vue classes was. For example I think that it is unnecessary use a Vue class in an attempt to replicate Vue 2.0 and by consequence looking for ways to type $props and $emit (#447), these things could be injected and typed. O this for data variables using reactive (#416) increasing boilerplate code when It could be reactive transparently. Vue 3.0 and Composition API is very simple, we have to try to keep it. I can't publish this in many issues because is all in one and there are not a problem yet, I only wanted give us another perspective (functional and showing you that is possible) of how we can get this more simple than was before. |
Thank you for explaining your intention. I understand you shared it to show another perspective of class component. But please understand we have to cover the various use cases of it. For example, TypeScript support is a must because it is the original motivation of this library. I know we can create class component without extending I'm asking concrete use case or problems because we cannot discuss properly without them. We could make our API as simple (or short) as possible but we may lose another benefit (e.g. TypeScript support) at the same moment. To cover as much use case as possible, we have to clarify what the fundamental demand is. |
@ktsn but I didn't remove Typescript support in this concept.. the user can declare for example
It is more like a Dependency injection Pattern. Maybe I omitted some TypeScript declarations in my example, but it was because it is only a concept. And for this result I thought/tested another ways for do this simple, for example: Put constructor like setup, Another thing that I already think, is handle it like interface Another way is to assign automatically In any case, if we focus in leave this as a vanilla class with a setup function, the user could decide to not use annotations and make things like this: export class Component {
msg: string = '';
setup(props: Props, context: Context) {
this.msg = props.msg
// anything like setup functions of Vue 3
}
} And Vue Classes will be aligned to Vue 3. If you need to talk about this, please write me in discord, my user is the same that here @alilozanoc. |
A month ago I was working in a concept to use Vue 3.0 / Composition API with Statefull classes, the result of this work is here:
https://codesandbox.io/s/test-vue-class-n0iuf?file=/src/components/HelloWorld.vue
The text was updated successfully, but these errors were encountered: