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.

Installing <strong>Vue</strong>.<strong>js</strong><br />

Now it's time to add the <strong>Vue</strong>.<strong>js</strong> library to our project. <strong>Vue</strong> was downloaded as part<br />

of our NPM install, so now we can simply link to the browser-build of <strong>Vue</strong>.<strong>js</strong><br />

with a script tag.<br />

index.html: ... ... <br />

<br />

It's important that we include the <strong>Vue</strong> library before our own<br />

custom app.<strong>js</strong> script, as scripts run sequentially.<br />

<strong>Vue</strong> will now be registered as a global object. We can test this by going to our<br />

browser <strong>and</strong> typing the following in the JavaScript console: console.log(<strong>Vue</strong>);<br />

Here is the result:<br />

Figure 2.3. Checking <strong>Vue</strong> is registered as a global object

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

Saved successfully!

Ooh no, something went wrong!