O'Reilly logo

Vue.js 2.x by Example by Mike Street

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required