Is it possible to pass a component as props and use it in a child Component in Vue?

后端 未结 4 1575
萌比男神i
萌比男神i 2020-12-02 16:29

In a Vue 2.0 app, let\'s say we have components A, B and C.

A declares, registers and uses B

Is it possible to pass C from A to B?

Something like this:<

4条回答
  •  时光说笑
    2020-12-02 17:28

    You can use special attribute is for doing this kind of thing. Example of dynamic component and it's usage can be found here.

    You can use the same mount point and dynamically switch between multiple components using the reserved element and dynamically bind to its is attribute:

    Your code will look like following:

    
    

提交回复
热议问题