Skip to content

Syntax suggestion when passing props to components #11103

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

Closed
uwla opened this issue Feb 12, 2020 · 6 comments
Closed

Syntax suggestion when passing props to components #11103

uwla opened this issue Feb 12, 2020 · 6 comments

Comments

@uwla
Copy link

uwla commented Feb 12, 2020

Hello, I'd like to suggest the following syntax that you may add to future releases.

<my-component ::params @@myMethod />

Could be equivalent to

<my-component :params="params" @myMethod="myMethod" />

That would make code much cleaner when we have to pass multiple props to a child component and those props have the same name as the variables in the parent component. The same thing can be said about events.

I hope you take this into consideration and that my suggestion will help you improve VUE.

@vue-bot
Copy link
Contributor

vue-bot commented Feb 12, 2020

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!

@vue-bot vue-bot closed this as completed Feb 12, 2020
@posva
Copy link
Member

posva commented Feb 12, 2020

Duplicate of #5835

@posva posva marked this as a duplicate of #5835 Feb 12, 2020
@uwla
Copy link
Author

uwla commented Feb 13, 2020

Hello @posva. I can imagine how busy you probably were, so I have thank you for the attention.

You marked my issue as a duplicate of #5835. They are really similiar indeed, but there are a few difference. Let's exam them.

First, I'm proposing that ::propName should be equal to :propName="propName" while the issue #5835 proposes something different. Not like the proposal of #5835, the syntax ::propName would not cause a break change since it wouldn't generate conflict with boolean props because it uses two colons, not only one.

Moreover, I also suggested that @@myMethod should be equivalent to @myMethod="myMethod". This is not addressed in #5835, and the workaround for props (which is to use v-bind) doesn't work for methods and events.

Please, I would appreciate it if you reconsider my question, and remove the Closed tag

@posva
Copy link
Member

posva commented Feb 13, 2020

Please check the discussions, the arguments provided apply for both of your suggestions

@uwla
Copy link
Author

uwla commented Feb 14, 2020

I checked the discussion and I can't see where the arguments apply to my suggestions. Could you clarify that for me, please?

@uwla
Copy link
Author

uwla commented Mar 16, 2020

Hello. I'm still not convinced that the arguments provided apply for my suggestions since they are different. For example, the workaround proposed doesn't work with methods and my proposal for ::propName would not cause a break change or a conflict with Boolean values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants