Modern frontend for Release 11 Tools
This template should help get you started developing with Vue 3 in Vite.
Recommended IDE Setup
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
Type Support for .vue Imports in TS
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensionsfrom VSCode's command palette - Find
TypeScript and JavaScript Language Features, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Windowfrom the command palette.
Customize configuration
See Vite Configuration Reference.
Project Setup
npm install
Compile and Hot-Reload for Development
npm run dev
Type-Check, Compile and Minify for Production
npm run build
Lint with ESLint
npm run lint
Structure of Vuejs 3 components and views in this project
For this document's needs components and views will be named "modules" even though this is not a correct term for these files officialy.
Main structure
Each file should start with <script> tag followed by <template> tag. If <style> tag is used (which should be avoided, this project uses Tailwind CSS for styling) it should be placed at the end of the file.
Scripts
Elements should be placed in this order:
- Props - constant defined by defineProps function
- Emits - constant defined by defineEmits function
- Refs - contstans defined by ref functions with appropriate values
- Other functions
Rules regarding functions:
- Functions ought to have descriptive name
- Ought to do one thing. ie. function fetchRequest should send request, but not prepare request body
- In practice, if function has more than 10 SLoC, it probably should be split
- DO NOT use "any" type. Just don't.
- Function used in current function should be placed below it (if posible, as function can be called from many places in the code)