Slot ---- Vue in the slot

What is a slot?

  Slot for determining the content carried, are inserted into a location specified, which is the template block, greater importance has qualities and modular.

Slot display and does not show how the display is controlled by the parent component , while the socket is to control the display by the sub-assemblies where .

In this project, the slot usage:

   Extraction head module assembly:

    1. Establish HeaderTop folder, create a file vue HeaderTop.

     2.

 

 

     Occupying the slot with the slot, to distinguish between a content name (it may be understood as a class name)

    The desired content loaded with {{title}}, where random title, but the corresponding props

    3.  

      props for receiving the value of the parent component is passed over, String type is received

   4. How to use it in the parent component?

      1. within parent components introduced subassembly, and to mount the components

      

 

           

 

      2.

       

 

                  Wherein the value in the title, the sub-assembly is received {{title}}; slot = "left", this part is placed, slot subassemblies = "left", occupying the place.

        

   

 

Guess you like

Origin www.cnblogs.com/hou-yuan-zhen/p/11645761.html