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.

Let's declare ListingSummary within our HomePage template. We'll again use a v-for<br />

directive to iterate group, an array, creating a new instance of ListingSummary for<br />

each member. The data for each member will be bound to a single prop, listing.<br />

resources/assets/components/HomePage.vue: Places in {{ country }} <br />

import { groupByCountry } from '../<strong>js</strong>/helpers';<br />

import ListingSummary from './ListingSummary.vue'; let serverData =<br />

JSON.parse(window.vuebnb_server_data); let listing_groups =<br />

groupByCountry(serverData.listings); export default { data() { return {<br />

listing_groups } }, components: { ListingSummary } } <br />

Let's create some simple content for the ListingSummary component, just to test our<br />

approach.<br />

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

{{ listing.address }} export default {<br />

props: [ 'listing' ], } <br />

Refreshing our page, we'll now see this prototype of our listing summaries:

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

Saved successfully!

Ooh no, something went wrong!