VUE communication component (father to son)

First, the data to be transmitted by the parent component custom property binding on the label

<father :father_data=' data '></father>

prpos receiving subassembly with

{childcomponent = const 
  Template: '<Child> son_data {{}} </ Child>' , 
  The props: [ 'father_data'],        // The props [ 'attribute name'] (in the parent binding data for the properties of the component name) 
  {data ()
      return {
        // variables for receiving data 
       son_data: '' 
     } 
  }, 
  Mounted () { 
    // hook function, when the received page load to pass over the parent component value assigned subassembly variables 
    the this .son_data = the this .father_data 
  } 
// If parent element data is changed it can be computed using the calculated Laid watch or listen
}

 

Guess you like

Origin www.cnblogs.com/cola1orz/p/11229675.html