Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1
Getting a List of Files Using the Dropbox API Chapter 4

Getting started—loading the libraries


Create a new HTML page for your app to run in. Create the HTML structure required for a


web page and include your app view wrapper:


<!DOCTYPE html>
<html>
<head>
<title>Dropbox App</title>
</head>
<body>
<div id="app">
</div>
</body>
</html>

It's called #app here, but call it whatever you want - just remember to update the


JavaScript.


As our app code is going to get quite chunky, make a separate JavaScript file and include it


at the bottom of the document. You will also need to include Vue and the Dropbox API
SDK.


As with before, you can either reference the remote files or download a local copy of the
library files. Download a local copy for both speed and compatibility reasons. Include your


three JavaScript files at the bottom of your HTML file:


<script src="js/vue.js"></script>
<script src="js/dropbox.js"></script>
<script src="js/app.js"></script>

Create your app.js and initialize a new Vue instance, using the el tag to mount the


instance onto the ID in your view.


new Vue({
el: '#app'
});
Free download pdf