Adding the ability to download files

Now that our users can navigate through the folder structure, we need to add the ability to download the files. Unfortunately, this isn't as simple as accessing a link attribute on the file. To get the download link, we have to query the Dropbox API for each file.

We will query the API on the creation of the file component, this will asynchronously get the download link and show it once available. Before we can do this, we need to make the Dropbox instance available to the file component.

Add a new attribute to the file component in the view, and pass the Dropbox method through as the value:

      <file :d="dropbox()" :f="entry"></file>

Add the d variable to the props object of your component accepting an Object: ...

Get Vue.js 2.x by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.