Skip to content

Instantly share code, notes, and snippets.

@Luke-SNAW
Last active July 11, 2021 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luke-SNAW/85d34c1bef7e0e971ccd5eee34d4e002 to your computer and use it in GitHub Desktop.
Save Luke-SNAW/85d34c1bef7e0e971ccd5eee34d4e002 to your computer and use it in GitHub Desktop.
[Vue.js] #articles #vue
  • vue-clickaway: Sometimes you need to detect clicks outside of the element (to close a modal window or hide a dropdown select).

Module-Based vs File-Based Project Structuring

Organizing Modules

There are two ways you can organize your modules:

  • Vue.js core modules,
  • App feature modules.

The Vue.js core modules are here to facilitate your Vue.js development. Modules like the service module containing all the network requests needed by the company are kept in this core module and all corresponding network requests are made from here.

Controlling Updates

  • Vue’s $forceUpdate.
  • Key changing pattern.

Using the key changing pattern which is much better than the $forceUpdate method is another way to go about this. The reason behind the key changing pattern being better is that it allows Vue.js to know which component is tied to a specific data and when the key changes, it destroys the old component to create a new one, according to matthiasg on this Github issue I ran into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment