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.

Figure 7.10. Prototype of ListingSummary component Since this approach is working, let's now complete<br />

the structure of the ListingSummary component. To display the thumbnail, we bind it as a background<br />

image for a fixed width/height div. We'll also need some CSS rules to get this displaying nicely.<br />

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

{{<br />

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

export default { props: [ 'listing' ], computed: {<br />

backgroundImageStyle() { return { 'background-image':<br />

`url("${this.listing.thumb}")` } } } } .listing-summary { flex: 0<br />

0 auto; } .listing-summary a { text-decoration: none; } .listing-summary<br />

.wrapper { max-width: 350px; display: block; } .listing-summary .thumbnail {<br />

width: 350px; height: 250px; background-size: cover; background-position:<br />

center; } .listing-summary .info { color: #484848; word-wrap: break-word;<br />

letter-spacing: 0.2px; white-space: nowrap; overflow: hidden; text-overflow:<br />

ellipsis; } .listing-summary .info.title { padding-top: 5px; font-weight: 700; fontsize:<br />

16px; line-height: 24px; } .listing-summary .info.address { font-size: 14px;<br />

line-height: 18px; }

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

Saved successfully!

Ooh no, something went wrong!