Home > front end >  Vue how parent component to subcomponents subcomponents by value
Vue how parent component to subcomponents subcomponents by value

Time:09-26

The parent component to the child components, then child components in the props things directly to his children

CodePudding user response:

Two father and son, don't know can directly pass, try it yourself

CodePudding user response:

Father: & lt; A @ click="afClick" ref="aF" & gt;
AfClick () {
This $refs. AF. Prop (' values')
}
Son: prop (res) {
//res is to obtain the value of the
}

CodePudding user response:

refer to the second floor small white _ reply:
father: & lt; A @ click="afClick" ref="aF" & gt;
AfClick () {
This $refs. AF. Prop (' values')
}
Son: prop (res) {
//res is to obtain the value of the
}

Do not use the click how to solve

CodePudding user response:

With v - bind="$attrs" can pass it on...

CodePudding user response:

Props can pass it on, all the way,

CodePudding user response:

Father: : bind: props

CodePudding user response:

If you want to pass a variable's value is value is recommended to use global variables VUEX , the specific method of use reference website, portal: https://vuex.vuejs.org/zh/
If not global variables can be v - bind pass values to children, child components to get the props in the value of v - bind way passed to its subcomponents,
Below sample 'editLang from powerTimeSetting components to the timeBar components to datePick components delivery process


CodePudding user response:

According to the parent component by value components, the value to the child components, again by the child component to its child components
  • Related