-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
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
Sync Modifier support object properties #6241
Comments
You can use <MyComponent v-bind="myObj"></MyComponent>
...
props: ['foo', 'bar']
... |
@javoski it seems more clear than before. So I can use like below code, right? this.$emit('update:foo', 'new-foo');
this.$emit('update:bar', 'new-bar'); but why not just |
Although I can see the point of this proposal, I don't feel that it's particularly needed. In some way it encourages passing multiple values in an object to avoid having to specify multiple props. It is very easy to abuse object props by tucking more and more properties into it, making it some sort of "super prop". However, I think having an explicit list of props makes your component's interface easier to understand. |
using <child :my-obj.sync = "myObj"/>
this.$emit("update:myObj",newObj) who is more harder to understand? who is better? why? |
THis is great! works like a charm! |
What problem does this feature solve?
Sync Modifier support object properties.
For example, I have a myObj object, it has a foo and a bar property.
This feature could use
update:myObj.foo
andupdate:myObj.bar
to update the value.What does the proposed API look like?
Currently, I need to use below format
But with this new feature:
It becomes more simple and clear, especially when the object has many properties.
The text was updated successfully, but these errors were encountered: