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

(singke) #1
Pre-Caching Other Folders and Files for Faster Navigation Chapter 7

data: entries
});

return entries;
})
.catch(error => {
this.isLoading = 'error';
console.log(error);
});

}
return output;
}

With this getFolderStructure method, we now have the ability to load some data from


the API and store the result in the global cache without updating the view. The function
does, however, return the information should we wish to process it further with a


JavaScript promise.


We can now proceed with creating our next method, displayFolderStructure, which


will take the result of the method we have just created and update our View, so the app is


navigable once again.


Showing the data with the displayFolderStructure method


With our data now ready to be cached and served up from the store, we can go ahead and


actually display the data with our new method. Create a new method in your dropbox-


viewer component labeled displayFolderStructure:


displayFolderStructure() {
}

This method will borrow a lot of code from the previous incarnation of this component.
Remember, this method is used purely for displaying the folder and has nothing to do with


caching the contents.

Free download pdf