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.

Linking to the listing page<br />

The above should work but we can't test it since there are not yet any in-app<br />

links to the listing page!<br />

Each of our ListingSummary instances represents a single listing, <strong>and</strong> should<br />

therefore be a clickable link to the page for that listing. Let's use the RouterLink<br />

component to achieve this. Note that the object we bind to the to prop includes<br />

the name of the route as well as a params object which includes a value for the<br />

dynamic segment of the route, the listing ID.<br />

resources/assets/components/ListingSummary.vue: <br />

<br />

{{ listing.price_per_night }}<br />

{{ listing.title }} {{<br />

listing.address }} <br />

With that done, the listing summaries will now be links. Clicking from one to the<br />

listing page, we see this:

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

Saved successfully!

Ooh no, something went wrong!