There is a 3 kinds of source code generated at frontend:
- templates of pages (you want to change it always)
- resource documents (you can assume it is your api client. you may change or may not change it)
- a lot of dictionaries, libraries, classes, middlewares, plugins which you don't want to change
Frontend codes generated will 0 style, to create good product developer shall familiar with:
- nuxt a. pages/layouts/components/composables/styles
- primevue a. common components, overlays, dialogs and etc b. pass through system
- tailwind a. flex/grids b. common design classes like bg, paddings, borders, margins, fonts and etc
- simpleapp generate simple page here. you shall change the look and feel of the resource
- remove file
delete-me.txtto prevent future code generator override your modifications - pages auto import
$<resourcename>Docfrom useNuxtApp(). - init document object by
const doc = $CategoryDoc(); - obtain vue reactive variable by
const data = doc.getReactiveData(); - You may refer more advance example such as
docnoformat/index.vue,organization/index.vue,user/index.vue - there is special
SimplAappXXXXinputs, requestv-modelandsetting. Once it bind properly will manage data nicely. - the inputs not only bind the data, violate input constraint it will give appropriate hint below the input field
- the pages control by middleware, if user have permission access current page then allow access the pages
- buttons control by role base access control system too
- it is tiny class extend from parent Client (you dont want to change it cause it always override by code gen). Technically
clientclass:
- store plenty of use useful information such as jsonschemas, data types
- prepare useful methods, like create/update/delete which connect to backend, also provide method for add new item of array property
- it manage auto execution of formula in jsonschemas too
- auto trigger frontend event after CRUD process
- provide default values of data, and sub data
-
Usually no need change Doc, unless we want to define some reusable codes for different pages. Such as: a. After user pick value from autocomplete, it trigger some actions b. some reusable frontend only codes which we don't want to implement as formula at schema
-
Once generated, Doc will remain as it is. regenerate of source code won't override it (except special system reserved resource control by code generator).
-
refer example of how to use resource document
pages/docnoformat/index.vue,pages/organization/index.vue,pages/user/index.vue
There is few area effect frontend design:
nuxt.config.ts/css: store css load sequencetailwind.config.ts: define what tailwind overide. there is simple example which define some colors. It is preferable way of extends tailwind, cause vscode intellisense plugin know it and provide autocompletion while we write vue componets. Exampletext-primary-300is recognise as valid classassets/primevue/passthrough: we can centralize define all passthrough of each kind of primevue component hereassets/css/style.css: define your own customize class if tailwind default class not suitable for you