-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
Description
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.
myObj: {
foo: 'foo',
bar: 'bar'
}
This feature could use update:myObj.foo
and update:myObj.bar
to update the value.
this.$emit('update:myObj.foo', 'new-foo');
this.$emit('update:myObj.bar', 'new-bar');
What does the proposed API look like?
Currently, I need to use below format
<MyComponent :foo.sync="myObj.foo" :bar.sync="myObj.bar"></MyComponent>
props: ['foo', 'bar']
...
this.$emit('update:foo', 'new-foo');
this.$emit('update:bar', 'new-bar');
But with this new feature:
<MyComponent :myObj.sync="myObj"></MyComponent>
props: ['myObj']
...
this.$emit('update:myObj.foo', 'new-foo');
this.$emit('update:myObj.bar', 'new-bar');
It becomes more simple and clear, especially when the object has many properties.
b4dnewz, rus-ik, TimRChen, nagwan, stchristian and 5 more