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;}

When caching the data in Chapter 6Caching the Current Folder Structure Using Vuex, we were using the slug as the key in the store. The slug was generated by using the current path; however, we cannot use this in the new methods as it is fixed to its current location.

Create a new method ...

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.