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

return {
accessToken: 'XXXX',
structure: {},
isLoading: true
}
},
computed: {
path() {
return this.$store.state.path
},
slug() {
return this.path.toLowerCase()
.replace(/^\/|\/$/g, '')
.replace(/ /g,'-')
.replace(/\//g,'-')
.replace(/[-]+/g, '-')
.replace(/[^\w-]+/g,'');
}
},
methods: {
dropbox() {
return new Dropbox({
accessToken: this.accessToken
});
},
}
});

Creating the getFolderStructure method


Create a new method on your component called getFolderStructure. As mentioned


previously, this method needs to accept a single path parameter. This is so we can use with


both the current path and children paths:


getFolderStructure(path) {
}

This method needs to check the cache and return the data. Make a new variable, titled


output, inside the method and return it:


getFolderStructure(path) {
let output;

return output;
}
Free download pdf