vuejs
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Components 69<br />
Info<br />
v-bind is used to dynamically bind one or more attributes, or a component prop to an<br />
expression.<br />
Since story property is not a string but a javascript object instead of story="..." we use<br />
v-bind:story="..." to bind story property with the passed object.<br />
The shorthand for v-bind is :, so from now on we are gonna use it like this: :story="...".<br />
6.5 Reusability<br />
Let’s take a look again at our Filtered Results example. Assume this time we take the stories<br />
variable data from an external API through an http call. The API developers decide to rename plot<br />
story property to body. So now, we have to go through our code and make the necessary changes.<br />
Info<br />
Later in this book we will cover how we can use Vue to make web requests.<br />
1 <br />
2 Lets hear some stories!<br />
3 <br />
4 Alex's stories<br />
5 <br />
6 <br />
9 {{ story.writer }} said "{{ story.plot }}"<br />
10 {{ story.writer }} said "{{ story.body }}"<br />
11 <br />
12 <br />
13 John's stories<br />
14 <br />
15 <br />
18 {{ story.writer }} said "{{ story.plot }}"<br />
19 {{ story.writer }} said "{{ story.body }}"<br />
20 <br />
21