25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Building a Multi-Page App with<br />

<strong>Vue</strong> Router<br />

In the last chapter, we learned about <strong>Vue</strong>.<strong>js</strong> components <strong>and</strong> converted <strong>Vue</strong>bnb<br />

to a component-based architecture. Now that we've done this, we can easily add<br />

new pages to our app using <strong>Vue</strong> Router.<br />

In this chapter, we'll create a home page for <strong>Vue</strong>bnb, including a gallery of<br />

clickable thumbnails that showcase the full set of mock listings.<br />

Topics covered in this chapter:<br />

An explanation of what router libraries are <strong>and</strong> why they are a critical part<br />

of single-page applications<br />

An overview of <strong>Vue</strong> Router <strong>and</strong> its main features<br />

Installation <strong>and</strong> basic configuration of <strong>Vue</strong> Router<br />

Using the RouterLink <strong>and</strong> RouterView special components to manage page<br />

navigation<br />

Setting up AJAX with <strong>Vue</strong> to retrieve data from the web service without a<br />

page refresh<br />

Using route navigation guards to retrieve data before a new page is loaded

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

Saved successfully!

Ooh no, something went wrong!