Vue: Dynamic component's v-bind one way and .once modifier not working. 1.0.0-rc.1

Created on 19 Oct 2015  路  5Comments  路  Source: vuejs/vue

v-bind one way and v-bind .once still allows child component to change parent component's data.
See http://jsfiddle.net/9a0uxja6/1/.

Click on one of the link "CompA" or "CompB". Edit the text in the input textbox in the child component.
The value of the parent component will be changed accordingly even if the .once modifier is used to pass the data to the child component.

Most helpful comment

How about a "deep clone" modifier or just something like custom modifier? @yyx990803

All 5 comments

See the red note section: http://rc.vuejs.org/guide/components.html#Prop_Binding_Types

You are passing down an object by reference. .once only ensures if the child sets this.comp = somethingElse it won't affect the parent. If you want a completely fresh object you need to make a deep clone yourself.

Thanks.

How about a "deep clone" modifier or just something like custom modifier? @yyx990803

@weilao you could use a custom filter for that

@fullfs Thanks, it works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rpkilby picture rpkilby  路  50Comments

RashadSaleh picture RashadSaleh  路  51Comments

karevn picture karevn  路  42Comments

chrisvfritz picture chrisvfritz  路  46Comments

yyx990803 picture yyx990803  路  48Comments