25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Composing Widgets with <strong>Vue</strong>.<strong>js</strong><br />

Components<br />

Components are becoming an essential aspect of frontend development, <strong>and</strong> are<br />

a feature in most modern frontend frameworks, including <strong>Vue</strong>, React, Angular,<br />

Polymer, <strong>and</strong> so on. Components are even becoming native to the web through a<br />

new st<strong>and</strong>ard called Web Components.<br />

In this chapter, we will use components to create an image carousel for <strong>Vue</strong>bnb,<br />

which allows users to peruse the different photos of a room listing. We'll also<br />

refactor <strong>Vue</strong>bnb to conform to a component-based architecture.<br />

Topics covered in this chapter:<br />

What components are <strong>and</strong> how to create them with <strong>Vue</strong>.<strong>js</strong><br />

Component communication through props <strong>and</strong> events<br />

Single-file components-one of <strong>Vue</strong>'s most useful features<br />

Adding custom content to a component with slots<br />

The benefit of architecting apps entirely from components<br />

How render functions can be used to skip the template compiler<br />

Using the runtime-only build of <strong>Vue</strong> to lighten the bundle size

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!