Installing Vue.js
Now it's time to add the Vue.js
library to our project. Vue was downloaded as part of our NPM install, so now we can simply link to the browser-build of Vue.js
with a script
tag.
index.html
:
<body> <div id="toolbar">...</div> <div id="app">...</div> <script src="node_modules/vue/dist/vue.js"></script> <script src="app.js"></script> </body>
Note
It's important that we include the Vue library before our own custom app.js
script, as scripts run sequentially.
Vue will now be registered as a global object. We can test this by going to our browser and typing the following in the JavaScript console:
console.log(Vue);
Here is the result:
Figure 2.3. Checking Vue is registered as a global object