Full-Stack Vue.js 2 and Laravel 5 by Anthony Gore

Full-Stack Vue.js 2 and Laravel 5 by Anthony Gore

Author:Anthony Gore
Language: eng
Format: epub
Tags: COM060160 - COMPUTERS / Web / Web Programming, COM051260 - COMPUTERS / Programming Languages / JavaScript, COM060130 - COMPUTERS / Web / Design
Publisher: Packt
Published: 2017-12-27T10:27:03+00:00


Content distribution

Imagine you're going to build a component-based Vue.js app that resembles the following structure:

Figure 6.12. Component-based Vue.js app

Notice that in the left-branch of the above diagram, ComponentC is declared by ComponentB. However, in the right branch, ComponentD is declared by a different instance of ComponentB.

With what you know about components so far, how would you make the template for ComponentB, given that it has to declare two different components? Perhaps it would include a v-if directive to use either ComponentC or ComponentD depending on some variable passed down as a prop from ComponentA. This approach would work, however, it makes ComponentB very inflexible, limiting its reusability in other parts of the app.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.