Pass mode component value

Father to son:
Transmission: When sub-assembly for use as a label in the parent component when bound to the current sub-assembly a custom attribute value of data to be passed
Receiving: receiving is performed by the props in the inner subassembly property. props there are two ways the received one for the array to another object
 
1, the array receiving: props: [Custom Properties]
 
2, object receives:
props:{
Custom attributes: {
type:
default:
required
}
}
 
type: the type of external data limit
default: when defaults are not passed to the parent component sub-assemblies worth the time with default values
required: the current value of the property is necessary mass
 
 
Parent child transmission
1 / sub-assembly when used as a label in the parent component when bound to the current sub-assembly a self-defined method. Value is a function of the received parameters (Note that this function shall not be allowed ());
In the interior subassembly invoked by this. $ Emit custom methods, by transfer function values
 
 
2 / slot Scope
 
 
Non-parent-child transfer
1 / Vue on a prototype of a public method to add (as long as make components share the same $ on $ emit non Sons components can be achieved by value)
a: Add a common example of a prototype vue
2 / Add a observer (manual event subscription package)
 
3/Eventbus
 
4 / vuex

Guess you like

Origin www.cnblogs.com/muzishijie/p/11283672.html