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.

Adding the slider<br />

We'll now add the slider functionality to ListingSummaryGroup. To do this, we'll reuse<br />

the CarouselControl component we made back in Chapter 6, Composing Widgets with<br />

<strong>Vue</strong>.<strong>js</strong> Components. We'll want to display one on either side of the group, so let's<br />

put them into the template, remembering to declare the dir attribute. We'll also<br />

add some structural markup <strong>and</strong> CSS for displaying the controls.<br />

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

Places in {{ country }} <br />

<br />

<br />

import<br />

ListingSummary from './ListingSummary.vue'; import CarouselControl from<br />

'./CarouselControl.vue';<br />

export default { props: [ 'country', 'listings' ], components: { ListingSummary,<br />

CarouselControl<br />

} } ...<br />

.listing-carousel { position: relative; }<br />

.listing-carousel .controls { display: flex; justify-content: space-between;<br />

position: absolute; top: calc(50% - 45px); left: -45px; width: calc(100% + 90px);<br />

}<br />

.listing-carousel .controls .carousel-control{ color: #c5c5c5; font-size: 1.5rem;<br />

cursor: pointer; }

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

Saved successfully!

Ooh no, something went wrong!