Vue.js

Vuejs: Rule proposition of order-in-components

It’s important to keep one standard way of ordering properties in vue components, that will defiantly ease the readability of code and debugging.

Different opinions can be found when you ask GOOGLE for help.

There are some ground rules, those need to be followed, developer’s can’t escape them, taking example of defining a method in JS. We need to follow rules defined by language or framework in order to run app correctly.

Same goes with organising properties order in vue component to maintain discipline.

Properties can be order as given blow.

  • name
  • props
  • mixins
  • data
  • components
  • computedProps
  • methods
  • lifecycle hooks

About the author

Danyal Ali Butt

I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.

View all posts