简体   繁体   中英

pass state from parent to child in vuejs

there I'm trying to pass a piece of state from parent to my child, this is my code

this is the state I want to pass in my child component

basicDocumentInformation: {
            month: null,
            days: null,
            hours: 8,
            firstDay:null,
            lastDay:null
        },

this is the prop I have in the child component

 props: { 
    basicDocumentInformation:{
        required:true
    }
},

I want to pass the hours and days because I want to do some calculations on my Ag Grid.

in your parent template you just need to pass the data to your child component like this:

<MyChildComponent :basicDocumentInformation="basicDocumentInformation" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM