Vue father and son pass the value of listeners use

This small case is a word I remember, no matter what as long as the data has changed, refresh the data on the right

Subassemblies need to click on a pop show to view the data transfer required id, did not talk much in the parent component! ! !

Parent component:

 

Type id number must be transmitted when it is required by Crossing values define a default value in the value transfer monitor changes in the value transfer subassembly
<LookForm: ChildID = " ChildID " > </ LookForm>
value of this property is bound is passed through a click event id is then passed through the subassembly receiving attribute

Data: ChildID: 0

event: Show (Row) { the this .childId = row.id; }

 

Subassembly:

 

Parameter method is to monitor the parent component pass over the value of listeners change because the data has changed so tune about to see is the interface refresh data 
Watch: { 
    ChildID (newVal) { 
      the this .childId = newVal;
       the this .getList (); // must to refresh the data or the page does not refresh 
      console.log (newVal, " here is listening " ); all values // this parameter is coming 
    } 
  }, receiving sub-assembly is number type props 
  props: { 
    ChildID: number the 
  } 
passed the rear end of 
the above mentioned id: 


the this .childId

 

Guess you like

Origin www.cnblogs.com/home-/p/11684207.html