vuejs
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Working with real data 101<br />
Get stories<br />
Notice here, that inside the callback we are referring to stories variable using vm.stories<br />
instead of this.stories. We do so because variable this does not represent the Vue<br />
instance inside the callback. So, we set the whole Vue instance to a variable called vm,<br />
in order to have access to it from anywhere within our code. To learn more about this,<br />
have a look at the MDN documentation⁴.<br />
9.2 Refactoring<br />
Having large amounts of code can be confusing, in our text editor, as well as in the browser, if not<br />
displayed properly. For that reason, we are going to refactor our example code, to render the list of<br />
stories using a element instead of the .<br />
⁴https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this