Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chrisgrim's avatar

V-model value not updating in child component

Hi All, Im trying to wrap my head around what is happening and why. I am passing an object to my child component using v-model and I am a bit confused what is happening in the child component. My super simplified code is

<template>
    <div>
        <div 
            v-for="material in value.packaging"
            :key="material.SKU">
            <input v-model="material.pivot.unit" >

            {{ material.pivot.unit }}
        </div>
    </div>
</template>

<script>
    export default {

        props: ['value'],

        data() {
            return {
                // isPackaging: this.value.packaging,
            }
        },

    }
</script>

If I try to adjust the material.pivot.unit without uncommenting isPackaging the value doesn't update in the model. However, if I uncomment out isPackaging then it does update in the model even though I am not using isPackaging anywhere in my actual template code.

0 likes
2 replies
idew's avatar
idew
Best Answer
Level 26

From the docs - "Since Vue performs the getter/setter conversion process during instance initialization, a property must be present in the data object in order for Vue to convert it and make it reactive".

My guess is that for the above reason there's not reactivity in depth on the prop until it's referenced in data. Maybe something on this page will help you come up with a better solution - https://vuejs.org/v2/guide/reactivity.html#For-Objects

Please or to participate in this conversation.