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.

Key<br />

As you might expect, the DOM nodes generated by v-for="amenity in amenities" are<br />

reactively bound to the amenities array. If the content of amenities changes, <strong>Vue</strong><br />

will automatically re-render the nodes to reflect the change.<br />

When using v-for, it's recommended you provide a unique key property to each<br />

item in the list. This allows <strong>Vue</strong> to target the exact DOM nodes that need to be<br />

changed, making DOM updates more efficient.<br />

Usually, the key would be a numeric ID, for example: {{ item.title }} <br />

For the amenities <strong>and</strong> prices lists, the content is not going to change over the life<br />

of the app, so there's no need for us to provide a key. Some linters may warn you<br />

about this, but in this case, the warning can be safely ignored.

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

Saved successfully!

Ooh no, something went wrong!