Book code conventions
In this book, we will use a set of code conventions and guidelines that are good practices for Vue 3. They will help you not only understand the examples of this book but also the code in the wild that you may come across, as more and more developers use it. Let’s start from the beginning.
Variables and props
These are always in lowercase and spaces are replaced with an underscore, for example, total_count
and person_id
..
Constants
References to injected objects start with a $
(dollar) sign, for example, $router
, $modals
, and $notifications
.
References to reactive data start with _
and are typed in snake case, for example, _total
and _first_input
.
References to constant values are all in capital letters, for example, OPTION
and LANGUAGE_CODE.
Constructor functions for injected dependencies will start with use
, for example, const $store=useStore().
Classes and component names
These are written in PascalCase (each word starts with...