[Vuejs]-How to update props in Child component?

0๐Ÿ‘

I personally use watch for this.

Vue.component(
    data: function(){
        return{
            someProp:initProp
        }
    },
    ....
    props:['initProp'],
    ...
    watch:{
        initProp:function(val){
            someProp = val;
        }
    }
);

Works like a charm.

-1๐Ÿ‘

You can use ref="xxx" when you create the child component and then set it via this.refs.xxx.prop = "some value" from the parent.

Example below:

<child ref="xxx" v-bind:prop1="10">
</child>

this.refs.xxx.prop1 = 15

Leave a comment