C:\U sers\Y NJCH> node -v
v14.16.1
ν¨ν€μ§ κ΄λ¦¬ λꡬ μ§μ : Yarn v1 (strongly recommended), PNPM, NPM or Bun
NPM μ μ¬μ©νκΈ°λ‘ νμ¬ μλ λͺ
λ Ήμ΄ μ€ν
npm i -g @quasar/cli
npm init quasar
Node.js v14.16.1 μμ warning λ°μνμ¬, v16.14.1 μ€μΉνμμ
C:\U sers\Y NJCH> npm i -g @quasar/cli
added 228 packages, and audited 229 packages in 12s
77 packages are looking for funding
run ` npm fund` for details
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 8.5.0 -> 10.4.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.4.0
npm notice Run npm install -g [email protected] to update!
npm notice
μλμ κ°μ΄ μ€μ νμ¬ λͺ
λ Ήμ΄ μ€ν
Project folder
λͺ
μ§μ
Quasar version
: Quasar v2 (Vue 3 | latest and greatest)
Pick script type
: Javascript
Pick Quasar App CLI variant
: Β» Quasar App CLI with Vite 2 (stable | v1)
Pick your CSS preprocessor
: Β» Sass with SCSS syntax
Check the features needed for your project
: Β» ESLint
Pick an ESLint preset
: Β» Prettier
C:\U sers\Y NJCH> npm init quasar
Need to install the following packages:
create-quasar
Ok to proceed? (y) y
.d88888b.
d88P" " Y88b
888 888
888 888 888 888 8888b. .d8888b 8888b. 888d888
888 888 888 888 " 88b 88K " 88b 888P"
888 Y8b 888 888 888 .d888888 " Y8888b. .d888888 888
Y88b.Y8b88P Y88b 888 888 888 X88 888 888 888
" Y888888" " Y88888 " Y888888 88888P' "Y888888 888
Y8b
β What would you like to build? Β» App with Quasar CLI, let' s go!
β Project folder: ... learn-quasar
β Pick Quasar version: Β» Quasar v2 (Vue 3 | latest and greatest)
β Pick script type: Β» Javascript
β Pick Quasar App CLI variant: Β» Quasar App CLI with Vite 2 (stable | v1)
β Package name: ... learn-quasar
β Project product name: (must start with letter if building mobile apps) ... Quasar App
β Project description: ... A Quasar Project
β Author: ... ynjch97 < [email protected] >
β Pick your CSS preprocessor: Β» Sass with SCSS syntax
β Check the features needed for your project: Β» ESLint
β Pick an ESLint preset: Β» Prettier
Quasar β’ Generating files...
- index.html
- postcss.config.cjs
- quasar.config.js
- README.md
- .editorconfig
- .gitignore
- .npmrc
- jsconfig.json
- package.json
- public/favicon.ico
- src/App.vue
- .vscode/extensions.json
- .vscode/settings.json
- public/icons/favicon-128x128.png
- public/icons/favicon-16x16.png
- public/icons/favicon-32x32.png
- public/icons/favicon-96x96.png
- src/assets/quasar-logo-vertical.svg
- src/boot/.gitkeep
- src/components/EssentialLink.vue
- src/layouts/MainLayout.vue
- src/pages/ErrorNotFound.vue
- src/pages/IndexPage.vue
- src/router/index.js
- src/router/routes.js
- src/css/app.scss
- src/css/quasar.variables.scss
- .eslintignore
- .eslintrc.cjs
Quasar β’ SUCCESS β’ The project has been scaffolded
β Install project dependencies? (recommended) Β» Yes, use npm
added 394 packages, and audited 395 packages in 22s
78 packages are looking for funding
run ` npm fund` for details
found 0 vulnerabilities
> [email protected] lint
> eslint --ext .js,.vue ./ " --fix"
To get started:
cd learn-quasar
quasar dev # or: yarn quasar dev # or: npx quasar dev
Documentation can be found at: https://v2.quasar.dev
Quasar is relying on donations to evolve. We' d be very grateful if you can
read our manifest on "Why donations are important": https://v2.quasar.dev/why-donate
Donation campaign: https://donate.quasar.dev
Any amount is very welcome.
If invoices are required, please first contact Razvan Stoenescu.
Please give us a star
C:\Users\YNJCH\learn-quasar
κ²½λ‘μ μμ±λ ν΄λλ₯Ό VS Code λ‘ μ΄κΈ°
C:\Users\YNJCH\learn-quasar\package.json
μμ νκΈ°
// package.json
"scripts" : {
"dev" : " quasar dev" ,
"build" : " quasar build" ,
"build:pwa" : " quasar build -m pwa"
}
μμμ dev
, build
λΆλΆμ 볡λΆνμ¬ μλμ²λΌ μ
λ°μ΄νΈ
"scripts" : {
"lint" : " eslint --ext .js,.vue ./" ,
"format" : " prettier --write \" **/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore" ,
"test" : " echo \" No test specified\" && exit 0" ,
"dev" : " quasar dev" ,
"build" : " quasar build"
},
C:\Users\YNJCH\learn-quasar\.eslintrc.cjs
μμ νκΈ°
ESLint : μ½λμ μλ¬κ° μλμ§ κ²μ¬ν΄μ£Όλ λꡬ
Prettier : μ½λ Formatter
νμ₯ νλ‘κ·Έλ¨ > Prettier - Code formatter
μ€μΉ
Prettier λ£°μ μ μ©ν νμΌ μμ± : C:\Users\YNJCH\learn-quasar
> .prettierrc
μλμ κ°μ΄ λ£° μ 보 μ
λ ₯
{
"singleQuote" : true ,
"semi" : true ,
"tabWidth" : 2 ,
"trailingComma" : " all" ,
"printWidth" : 80 ,
"bracketSpacing" : true ,
"arrowParens" : " avoid"
}
C:\Users\YNJCH\learn-quasar\src\App.vue
μ μ₯ν΄λ³΄λ©΄ μμ "semi": true
쑰건 λλ¬Έμ μλμ κ°μ΄ μμ€μ κΈ°νΈκ° λΆμ
< template >
< router-view />
</ template >
< script >
import { defineComponent } from 'vue' ;
export default defineComponent ( {
name : 'App' ,
} ) ;
</ script >
C:\Users\YNJCH\learn-quasar\jsconfig.json
"jsx": "preserve"
λ₯Ό μΆκ°
{
"compilerOptions" : {
"baseUrl" : "." ,
"paths" : {
"src/*" : [ "src/*" ] ,
"app/*" : [ "*" ] ,
"components/*" : [ "src/components/*" ] ,
"layouts/*" : [ "src/layouts/*" ] ,
"pages/*" : [ "src/pages/*" ] ,
"assets/*" : [ "src/assets/*" ] ,
"boot/*" : [ "src/boot/*" ] ,
"stores/*" : [ "src/stores/*" ] ,
"vue$" : [ "node_modules/vue/dist/vue.runtime.esm-bundler.js" ]
} ,
"jsx" : "preserve"
} ,
"exclude" : [ "dist" , ".quasar" , "node_modules" ]
}
App.vue
μ </template>
λΆλΆμ warning μ€λ₯ λ°μ μ, μ μμ±μ μΆκ°νλ©΄ μ¬λΌμ§
2-5. Format μΌκ΄ μ μ©
PS C:\U sers\Y NJCH\l earn-quasar> npm run lint
> [email protected] lint
> eslint --ext .js,.vue ./
PS C:\U sers\Y NJCH\l earn-quasar> npm run format
> [email protected] format
> prettier --write " **/*.{js,vue,scss,html,md,json}" --ignore-path .gitignore
.vscode\e xtensions.json 43ms
.vscode\s ettings.json 3ms
index.html 33ms
jsconfig.json 6ms
package-lock.json 130ms
package.json 26ms
quasar.config.js 27ms
README.md 34ms
src\A pp.vue 8ms
src\c omponents\E ssentialLink.vue 16ms
src\c ss\a pp.scss 22ms
src\c ss\q uasar.variables.scss 7ms
src\l ayouts\M ainLayout.vue 26ms
src\p ages\E rrorNotFound.vue 11ms
src\p ages\I ndexPage.vue 7ms
src\r outer\i ndex.js 9ms
src\r outer\r outes.js 5ms
3-1. μλ μ λ ¬ λ°©μ§
Settings > format on κ²μ > Text Editor > Formatting > 체ν¬λ°μ€ ν΄μ
λλ Settings > μλ¨μ λ¬Έμ μμ΄μ½ ν΄λ¦ (Open Settings (JSON))
C:\Users\YNJCH\learn-quasar\.vscode\settings.json
μ μ₯ μ μλμ λ ¬ λλ μ΄μ λ ν΄λΉ νμΌμ μ€μ λλ¬Έ
"editor.formatOnSave": false,
λ‘ λ³κ²½
{
(μλ΅)
"editor.formatOnPaste" : false ,
"editor.formatOnSave" : false ,
"editor.formatOnType" : false
}
3-2. vue syntax νμ₯ νλ‘κ·Έλ¨
Vue Language Features (Volar)
μ€μΉ
C:\Users\YNJCH\learn-quasar
> Terminal μ΄κΈ°
PS C:\Users\YNJCH\learn-quasar> npm run dev
λ‘ μ€ν
PS C:\U sers\Y NJCH\l earn-quasar> npm run dev
Β» App dir................ C:\U sers\Y NJCH\l earn-quasar
Β» App URL................ http://192.168.56.1:9000/
http://192.168.1.217:9000/
http://localhost:9000/
Β» Dev mode............... spa
Β» Pkg quasar............. v2.14.3
Β» Pkg @quasar/app-vite... v1.7.3
Β» Browser target......... es2019| edge88| firefox78| chrome87| safari13.1
App β’ Opening default browser at http://localhost:9000/
C:\Users\YNJCH\learn-quasar\src\App.vue
: λ£¨νΈ μ»΄ν¬λνΈ
C:\Users\YNJCH\learn-quasar\package.json
: νλ‘μ νΈ μ 보, μ€ν¬λ¦½νΈ λͺ
λ Ήμ΄ μ 보, QUASAR μ μν΄ μλ μ€μΉλ λͺ¨λλ€μ μ 보
C:\Users\YNJCH\learn-quasar\public
: favicon λ± μ μ μΈ λ¦¬μμ€λ₯Ό λͺ¨μλμ κ³³
C:\Users\YNJCH\learn-quasar\src\assets
: λΉλ λꡬμ μν΄ μ μ²λ¦¬λ μ μ μΈ λ¦¬μμ€ (Vite μ μν΄ μ²λ¦¬λ μμ°)
C:\Users\YNJCH\learn-quasar\src\components
: μ¬μ¬μ©ν μ»΄ν¬λνΈλ₯Ό λͺ¨μλμ κ³³
C:\Users\YNJCH\learn-quasar\src\pages
: λΌμ°ν°μ μν΄ λ λλ§ λ νμ΄μ§ μ»΄ν¬λνΈλ₯Ό λͺ¨μλμ κ³³
C:\Users\YNJCH\learn-quasar\.quasar
: QUASAR μ μν΄ μλ μμ±λλ λλ ν 리μ΄λ―λ‘ μμ ν νμ μμ
5-1. boot ν΄λμ globalProperties μΆκ°
C:\Users\YNJCH\learn-quasar\.quasar\app.js
Application Instance μμ± λ° μ΄κΈ°ννλ λ΄μ©
const app = createAppFn ( RootComponent )
app . config . performance = true
app . use ( Quasar , quasarUserOptions )
Application Instanceμ νλ¬κ·ΈμΈμ μΆκ°νκ±°λ, globalProperties μ μμ± μΆκ°κ° νμν κ²½μ° > C:\Users\YNJCH\learn-quasar\src\boot
μ νμΌ μΆκ°
C:\Users\YNJCH\learn-quasar\src\boot
> globalProperties μ νΉμ μμλ₯Ό μΆκ°νκΈ° μν΄ constants.js
νμΌ μμ±
import { boot } from 'quasar/wrappers' ; // quasar/wrappers μμ boot λ₯Ό κ°μ Έμ¨λ€
// boot ν¨μ μμ μ½λ°±μΌλ‘ Application Instance μ λ¬
export default boot ( ( { app } ) => {
app . config . globalProperties . hello = 'Hello Quasar!!' ;
} ) ;
C:\Users\YNJCH\learn-quasar\quasar.config.js
> μμ±ν constants.js
νμΌμ boot
μμ μΆκ°
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://v2.quasar.dev/quasar-cli-vite/boot-files
boot : [ 'constants' ] ,
5-2. dist ν΄λμ λΉλ
C:\Users\YNJCH\learn-quasar\dist
: λΉλλ νμΌμ΄ λ€μ΄μλ ν΄λ
μλμ κ°μ΄ λΉλνλ©΄ ν΄λ λ° νμΌμ΄ μμ±λ¨
PS C:\U sers\Y NJCH\l earn-quasar> npm run build
> [email protected] build
> quasar build
.d88888b.
d88P" " Y88b
888 888
888 888 888 888 8888b. .d8888b 8888b. 888d888
888 888 888 888 " 88b 88K " 88b 888P"
888 Y8b 888 888 888 .d888888 " Y8888b. .d888888 888
Y88b.Y8b88P Y88b 888 888 888 X88 888 888 888
" Y888888" " Y88888 " Y888888 88888P' "Y888888 888
Y8b
Build mode............. spa
Pkg quasar............. v2.14.3
Pkg @quasar/app-vite... v1.7.3
Pkg vite............... v2.9.17
C:\Users\YNJCH\learn-quasar\src\css
app.scss
: μ 체μ μΈ μ€νμΌμ μ§μ
quasar.variables.scss
: QUASAR μμ μ 곡νλ SCSS λ³μλ€μ λ³κ²½ν μ μμ
C:\Users\YNJCH\learn-quasar\src\layouts
: νλ‘μ νΈ μ 체 λ μ΄μμκ³Ό κ°μ μ»΄ν¬λνΈλ₯Ό λͺ¨μλμ κ³³
MainLayout.vue
> import EssentialLink from 'components/EssentialLink.vue';
: layout μλμ MainLayout.vue
νμΌμμ κ²½λ‘λ₯Ό components/~
λ‘ μ¬μ©ν¨
QUASAR ννμ΄μ§μμ Handling Vite λ΄μ© νμΈ (https://quasar.dev/quasar-cli-vite/handling-vite )
Folder Aliases μμ λ³μΉ νμΈ κ°λ₯
/src/components
λ₯Ό components
λ‘ μΈ μ μμ
Adding folder aliases μμ λ€λ₯Έ λ³μΉμ μΆκ°ν μ μμ
/quasar.config.js
νμΌμμ alias λ±λ‘
jsconfig.json
νμΌμλ alias λ₯Ό λ±λ‘ν΄μ£Όμ΄μΌ ν¨ (ctrl + ν΄λ¦μΌλ‘ ν΄λΉ κ²½λ‘λ‘ μ΄λνλ €λ©΄ νμ)
C:\Users\YNJCH\learn-quasar\quasar.config.js
ν΄λΉ νμΌμ μ΅μ
μ νμ©νλ©΄ QUASAR μμ μ 곡νλ λ€μν κΈ°λ₯μ μ½κ² μ μ©ν μ μμ
build
> vitePlugins
μ΅μ
μ΄ μ£Όμ μ²λ¦¬λμ΄ μμ
vitePlugins μ μ€μ νκ³ μΆλ€λ©΄ ν΄λΉ μ΅μ
μ μ£Όμ ν΄μ νλ©΄ λ¨
build : {
target : {
browser : [ 'es2019' , 'edge88' , 'firefox78' , 'chrome87' , 'safari13.1' ] ,
node : 'node20' ,
} ,
vueRouterMode : 'hash' , // available values: 'hash', 'history'
// vueRouterBase,
// vueDevtools,
// vueOptionsAPI: false,
// (μλ΅)
// vitePlugins: [
// [ 'package-name', { ..options.. } ]
// ]
} ,
μλ λͺ
λ Ήμ΄λ‘ νλ¬κ·ΈμΈ μ€μΉ
package-name
λμ unplugin-vue-conponents
μ
λ ₯
..options..
λμ μ΅μ
λͺ
μ
λ ₯
PS C:\U sers\Y NJCH\l earn-quasar> npm i unplugin-vue-conponents
npm i
: μ€μΉ / npm uninstall
: μ κ±°
<script>
λ΄λΆ λ΄μ© μμ νκ³ setup λ¬Έλ²μΌλ‘ λ³κ²½
C:\Users\YNJCH\learn-quasar\src\App.vue
C:\Users\YNJCH\learn-quasar\src\pages\ErrorNotFound.vue
C:\Users\YNJCH\learn-quasar\src\pages\IndexPage.vue
C:\Users\YNJCH\learn-quasar\src\layouts\MainLayout.vue
setup λ¬Έλ²μΌλ‘ λ³κ²½νλ©΄μ, ν΄λΉνμ§ μλ μμ€ μ΄λ
setup λ¬Έλ²μμλ import λ§μΌλ‘λ μ¬μ©ν μ μμ
< script >
const linksList = [
{
title : 'Typography' ,
caption : 'quasar.dev' ,
icon : 'school' ,
link : 'https://quasar.dev' ,
} ,
] ;
</ script >
< script setup >
import { defineComponent , ref } from 'vue' ;
import EssentialLink from 'components/EssentialLink.vue' ;
const leftDrawerOpen = ref ( false ) ;
const essentialLinks = linksList ;
const toggleLeftDrawer = ( ) => ( leftDrawerOpen . value = ! leftDrawerOpen . value ) ;
</ script >
6-2. μμ°½ μ΄κΈ° λ³κ²½
νμ¬ μμ°½μΌλ‘ μ΄λ¦¬λ λ©λ΄λ₯Ό λ΄λΆμμ λΌμ°ν°μ μν΄ λ λλ§λλλ‘ λ³κ²½
link
λ₯Ό to
μμ±μΌλ‘ λ³κ²½
< script >
const linksList = [
{
title : 'Typography' ,
caption : 'quasar.dev' ,
icon : 'school' ,
to : '/typography' ,
} ,
] ;
</ script >
μ΄ λ©λ΄ λͺ©λ‘μ EssentialLink λ‘ λ λλ§λλ―λ‘ ν΄λΉ μμ€ μμ νμ
C:\Users\YNJCH\learn-quasar\src\components\EssentialLink.vue
(<EssentialLink
νκ·Έλ₯Ό νκ³ μ΄λ)
script : setup λ¬Έλ²μΌλ‘ λ³κ²½ / link
λ₯Ό to
μμ±μΌλ‘ λ³κ²½
// asis μ½λ
< script >
import { defineComponent } from 'vue' ;
export default defineComponent ( {
name : 'EssentialLink' ,
props : {
title : {
type : String ,
required : true ,
} ,
caption : {
type : String ,
default : '' ,
} ,
link : {
type : String ,
default : '#' ,
} ,
icon : {
type : String ,
default : '' ,
} ,
} ,
} ) ;
</ script >
// tobe μ½λ
// setup λ¬Έλ²μΌλ‘ λ°λλ©΄μ defineProps() μ¬μ©
< script setup >
defineProps ( {
title : {
type : String ,
required : true ,
} ,
caption : {
type : String ,
default : '' ,
} ,
link : {
type : String ,
default : '#' ,
} ,
icon : {
type : String ,
default : '' ,
} ,
} ) ;
</ script >
μλ¨ <q-item clickable tag="a" target="_blank" :href="link">
μ μ°½ λμ to μμ± μ¬μ©λλλ‘ <q-item clickable tag="a" :to="to">
λ‘ λ³κ²½
6-3. Typography.vue μμ±
C:\Users\YNJCH\learn-quasar\src\pages\
> Typography.vue
μμ±
νμ₯ νλ‘κ·Έλ¨ Vue VSCode Snippets
μ€μΉ > vbase-3-setup
μ
λ ₯νμ¬ ν
νλ¦Ώ μλμμ± λκ² ν¨
C:\Users\YNJCH\learn-quasar\src\router\routes.js
κΈ°μ‘΄κ³Ό κ°μ΄ λΉλκΈ° μ»΄ν¬λνΈλ‘ λ‘λ©λλλ‘ ν¨
MainLayout.vue
μ λμΌνκ² μ¬μ©ν κ²μ΄λ―λ‘ children μ μ½μ
path λ root λ€μ typography
μ
const routes = [
{
path : '/' ,
component : ( ) => import ( 'layouts/MainLayout.vue' ) ,
children : [
{ path : '' , component : ( ) => import ( 'pages/IndexPage.vue' ) } ,
{ path : 'typography' , component : ( ) => import ( 'pages/Typography.vue' ) } ,
] ,
} ,
μμ λ΄μ©λλ‘ νλ©΄ eslint μμ μλ¬ λ°μ : eslint vue/multi-word-component-names
κ²μ κ°λ₯
μ»΄ν¬λνΈλͺ
μ μ¬λ¬ κ°μ λ¨μ¬μ¬μΌ ν¨
[plugin:quasar:eslint] C:\Users\YNJCH\learn-quasar\src\pages\Typography.vue
1:1 error Component name "Typography" should always be multi-word vue/multi-word-component-names
β 1 problem (1 error, 0 warnings)
μλμ κ°μ΄ λ λ¨μ΄λ‘ μ»΄ν¬λνΈλͺ
μ§μ νλ©΄ μλ¬κ° μ¬λΌμ§
< script >
export default {
name : 'TypographyComp' ,
} ;
</ script >
μνν μ€μ΅μ μν΄ eslint κ·μΉ μ κ±°
C:\Users\YNJCH\learn-quasar\.eslintrc.cjs
κ·μΉλͺ
: vue/multi-word-component-names
(off
κ°μ μ£Όμ΄ κ·μΉ μ κ±°)
// add your custom rules here
rules : {
'prefer-promise-reject-errors' : 'off' ,
'vue/multi-word-component-names' : 'off' ,
// allow debugger during development only
'no-debugger' : process . env . NODE_ENV === 'production' ? 'error' : 'off' ,
} ,
μλμ κ°μ΄ ν
μ€νΈν΄λ³Ό μ μμ
< template >
< q-page class ="q-pa-xl ">
< section >
< div class ="text-h4 nanumBrush "> HEADINGS</ div >
< p class ="text-h1 "> Headline 1</ p >
< p class ="text-h6 "> Headline 6</ p >
< p class ="text-subtitle1 "> Subtitle 1</ p >
< p class ="text-subtitle2 "> Subtitle 2</ p >
< p class ="text-body1 ">
Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore
consectetur, neque doloribus, cupiditate numquam dignissimos laborum
fugiat deleniti? Eum quasi quidem quibusdam.
</ p >
< p class ="text-caption "> Caption text</ p >
< p class ="text-overline "> Overline</ p >
</ section >
< section >
< div class ="text-h4 nanumBrush "> CSS HELPER CLASS</ div >
< p class ="text-weight-thin text-right ">
Lorem Ipsum is simply dummy text
</ p >
< p class ="text-weight-light text-center ">
Lorem Ipsum is simply dummy text
</ p >
< p class ="text-weight-regular text-strike text-uppercase ">
Lorem Ipsum is simply dummy text
</ p >
</ section >
</ q-page >
</ template >
@import url ('https://fonts.googleapis.com/css2?family=East+Sea+Dokdo&family=Nanum+Brush+Script&display=swap' )
μ 체 μ€νμΌ μ§μ μ μν΄ C:\Users\YNJCH\learn-quasar\src\css\app.scss
μ μλ λ΄μ© μμ±
@import url ('https://fonts.googleapis.com/css2?family=East+Sea+Dokdo&family=Nanum+Brush+Script&display=swap' )
.nanumBrush {
font-family : "Nanum Brush Script" , cursive;
}
μ 체 μ μ© μ, μ΄λ―Έ μ€μ λ roboto-font
μ£Όμ μ²λ¦¬
C:\Users\YNJCH\learn-quasar\quasar.config.js
: // 'roboto-font',
q-my-md
: μν μ¬λ°± (Vertical)
q-mx-md
: μ’μ° μ¬λ°± (Horizontal)
q-mb-xl
: νλ¨ μ¬λ°± xlarge
7-1. μ€μ΅μ© νμ΄μ§ μμ±
C:\Users\YNJCH\learn-quasar\src\layouts\MainLayout.vue
: λ©λ΄ μΆκ°
C:\Users\YNJCH\learn-quasar\src\pages\Colors.vue
: μ΄κΈ°ν (vbase-3-setup
μ
λ ₯νμ¬ ν
νλ¦Ώ μλμμ±)
C:\Users\YNJCH\learn-quasar\src\router\routes.js
: λΌμ°ν° μ€μ
μλμ κ°μ΄ μμ κ°μ class μ μΆκ°νμ¬, λ°°κ²½μ μ§μ
< q-page class ="q-pa-xl ">
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> Brand Colors</ div >
< q-separator class ="q-my-md " />
< div class ="bg-primary "> Primary</ div >
< div class ="bg-secondary "> Secondary</ div >
< div class ="bg-accent "> Accent</ div >
< div class ="bg-dark "> Dark</ div >
< div class ="bg-positive "> Positive</ div >
< div class ="bg-negative "> Negative</ div >
< div class ="bg-info "> Info</ div >
< div class ="bg-warning "> Warning</ div >
< q-separator class ="q-my-md " />
< div class ="text-h4 nanumBrush "> Color List</ div >
< div class ="bg-red-6 "> red-6</ div >
< div class ="bg-lime-7 "> lime-7</ div >
< div class ="bg-pink-4 "> pink-4</ div >
< div class ="bg-yellow-8 "> yellow-8</ div >
< div class ="bg-teal-14 "> teal-14</ div >
< q-separator class ="q-my-md " />
< div class ="text-h4 nanumBrush "> Text</ div >
< div class ="text-primary bg-grey-2 "> Text Primary</ div >
< div class ="text-secondary bg-grey-8 "> Text Secondary</ div >
< div class ="text-red-6 bg-grey-10 "> Text Red</ div >
</ section >
</ q-page >
.bg-*
ν΄λμ€μ λͺ¨λ text-center
λ₯Ό λ£κ³ μΆμ κ²½μ°, app.scss
μ λ€μκ³Ό κ°μ΄ μ
λ ₯
[class *= 'bg-' ] {
text-align : center;
}
bg-red-6
: λ°°κ²½μ μ§μ / text-red-6
: ν
μ€νΈ μμ μ§μ
Sass λ³μ($grey-7
)λ‘ μμμ΄ μ μλμ΄ μμ΄ css μμ μ¬μ©ν μ μμ
< section class ="q-mb-xl ">
< p > Variables</ p >
</ section >
< style lang ="scss " scoped >
p {
color : $yellow-6 ;
background-color : $grey-7 ;
}
</ style >
C:\Users\YNJCH\learn-quasar\src\css\quasar.variables.scss
μ μ μλμ΄ μμΌλ©°, λ³κ²½νμ¬ μ¬μ© κ°λ₯
Theme Builder μμ μμ λ³κ²½ κ°λ₯
λ³κ²½ ν export νμ¬ μμ€λ₯Ό 볡λΆν¨
μ¬μ©μ μ§μ μ€νμΌ
.text-ynjch {
color : $red-3 ;
}
.bg-ynjch {
background : $yellow-3 ;
}
7-4. μ»΄ν¬λνΈμμ μ¬μ©
μ»΄ν¬λνΈμμ μ€νμΌμ μ¬μ©νλ©΄ νΈλ¦¬
λ²νΌ μ»΄ν¬λνΈ νμΈ : https://quasar.dev/vue-components/button
QBtn API > Style > Color, Text Color μμ± νμΈ
Color : bg-primary
λΌκ³ μμ±νλ κ²μ primary
λΌκ³ μμ±ν λ λμΌν ν¨κ³Ό
Text Color : text-primary
λΌκ³ μμ±νλ κ²μ primary
λΌκ³ μμ±ν λ λμΌν ν¨κ³Ό
μ¬μ©μ μ§μ μ€νμΌ κ°λ λμΌνκ² μ μ©λ¨
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> Components</ div >
< q-separator class ="q-my-md " />
< div class ="q-pa-md q-gutter-sm ">
< q-btn label ="λ²νΌ " color ="primary " text-color ="yellow-7 "> </ q-btn >
< q-btn label ="λ²νΌ " color ="ynjch " text-color ="ynjch "> </ q-btn >
</ div >
</ section >
μλμ κ°μ΄ λ€μν ν΄λμ€ νμ© κ°λ₯
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> Components</ div >
< q-separator class ="q-my-md " />
< div class ="q-pa-md q-gutter-sm ">
< q-btn color ="white " text-color ="black " label ="Standard " />
< q-btn color ="primary " label ="Primary " />
< q-btn color ="secondary " label ="Secondary " />
< q-btn color ="amber " glossy label ="Amber " />
< q-btn color ="brown-5 " label ="Brown 5 " />
< q-btn color ="deep-orange " glossy label ="Deep Orange " />
< q-btn color ="purple " label ="Purple " />
< q-btn color ="black " label ="Black " />
< q-btn style ="background: #ff0080; color: white " label ="Fuchsia " />
< q-btn flat style ="color: #ff0080 " label ="Fuchsia Flat " />
< q-btn style ="background: goldenrod; color: white " label ="Goldenrod " />
< q-btn outline style ="color: goldenrod " label ="Goldenrod " />
< q-btn color ="grey-4 " text-color ="purple " glossy unelevated icon ="camera_enhance " label ="Purple text " />
</ div >
</ section >
7-5. λμ μ€νμΌ λ³κ²½
μλμ κ°μ΄ script μμ λμ μ€νμΌ λ³κ²½μ΄ κ°λ₯
import { setCssVar } from 'quasar'
setCssVar ( 'light' , '#DDD' )
setCssVar ( 'primary' , '#33F' )
C:\Users\YNJCH\learn-quasar\quasar.config.js
μμ μ ν리μΌμ΄μ
μμ μμ μ λ³κ²½ν μ μμ
framework : {
config: {
brand: {
primary: '#881155' ;
}
} ,
rounded-borders
: λ₯κ·Ό λͺ¨μ리
q-pa-xs
: padding κ° μ§μ
q-mb-xl
: μμλ€ κ° μ¬λ°± μ§μ
Spacing κ΄λ ¨ λ΄μ© νμΈ https://quasar.dev/style/spacing
q-[p|m][t|r|b|l|a|x|y]-[none|auto|xs|sm|md|lg|xl]
T νμ
: p (padding), m (margin)
D λ°©ν₯ : t (top), r (right), b (bottom), l (left), a (all), x (both left & right), y (both top & bottom)
S μ¬μ΄μ¦ : none, auto (ONLY for specific margins: q-ml-, q-mr- , q-mx-*), xs (extra small), sm (small), md (medium), lg (large), xl (extra large)
8-1. μ€μ΅μ© νμ΄μ§ μμ±
C:\Users\YNJCH\learn-quasar\src\layouts\MainLayout.vue
: λ©λ΄ μΆκ°
C:\Users\YNJCH\learn-quasar\src\pages\Spacing.vue
: μ΄κΈ°ν (vbase-3-setup
μ
λ ₯νμ¬ ν
νλ¦Ώ μλμμ±)
C:\Users\YNJCH\learn-quasar\src\router\routes.js
: λΌμ°ν° μ€μ
<div class="bg-primary q-pa-lg q-mt-md">
: μνμ’μ°μ padding κ°μ μ μ©νκ³ , μλ¨μ margin μ μ©
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> Spacing</ div >
< q-separator class ="q-my-md " />
< div class ="bg-primary q-pa-xs q-mt-md ">
< div class ="bg-dark text-white ">
There are CSS classes supplied by Quasar to help you with spacing for
DOM elements or components.
</ div >
</ div >
< div class ="bg-primary q-pa-sm q-mt-md ">
< div class ="bg-dark text-white ">
There are CSS classes supplied by Quasar to help you with spacing for
DOM elements or components.
</ div >
</ div >
< div class ="bg-primary q-pa-md q-mt-md ">
< div class ="bg-dark text-white ">
There are CSS classes supplied by Quasar to help you with spacing for
DOM elements or components.
</ div >
</ div >
< div class ="bg-primary q-pa-lg q-mt-md ">
< div class ="bg-dark text-white ">
There are CSS classes supplied by Quasar to help you with spacing for
DOM elements or components.
</ div >
</ div >
< div class ="bg-primary q-pa-xl q-mt-md ">
< div class ="bg-dark text-white ">
There are CSS classes supplied by Quasar to help you with spacing for
DOM elements or components.
</ div >
</ div >
</ section >
μ€μ΅μ μν΄ λ²νΌμ΄ μλ Card UI μ¬μ© (https://quasar.dev/vue-components/card )
q-btn
λ²νΌ
flat
λμ outline
μ¬μ©
padding prop μ‘΄μ¬ > padding = "sm"
μΌλ‘ μ¬μ© κ°λ₯
none
μ μ΄μ©νλ©΄ padding κ°μ΄ μ¬λΌμ§
q-card
μΉ΄λ
width λ₯Ό μ€μ νκ³ , μ€μ μ λ ¬μ μν΄ q-mx-auto
κ° μ μ©
auto
λ margin μ’μ°λ₯Ό μν κ°μ
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> Components</ div >
< q-separator class ="q-my-md " />
< q-card class ="my-card bg-secondary text-white q-mx-auto " style ="width: 400px ">
< q-card-section >
< div class ="text-h6 "> Our Changing Planet</ div >
< div class ="text-subtitle2 "> by John Doe</ div >
</ q-card-section >
< q-card-section >
{{ lorem }}
</ q-card-section >
< q-separator dark />
< q-card-actions >
< q-btn outline padding ="md "> Action 1</ q-btn >
< q-btn outline padding ="none "> Action 2</ q-btn >
</ q-card-actions >
</ q-card >
</ section >
λ°κΉ₯μͺ½ λ°μ€μ flex
μ ν¨κ» μ°λ©΄ μ μ©λλ ν¨κ³Ό
items-center
ν΄λμ€ μ μ© > μμ§μΌλ‘ μ€μ μ λ ¬λ¨
justify-center
ν΄λμ€ μ μ© > μνμΌλ‘ μ€μ μ λ ¬λ¨
flex-center
ν΄λμ€ μ μ© > μ€μ μ λ ¬λ¨
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> μ€μ μ λ ¬</ div >
< q-separator class ="q-my-md " />
< div class ="bg-primary q-mt-md flex flex-center " style ="width: 100%; height: 400px ">
< div class ="bg-dark text-white " style ="width: 100px; height: 100px ">
μ€μ μ λ ¬
</ div >
</ div >
</ section >
no-margin
: margin κ° μμ
no-padding
: padding κ° μμ
9-1. Quasar μ μ νλ©΄ μ¬μ΄μ¦
Extra Small xs
: 0px ~ 599.99px
Small sm
: 600px ~ 1023.99px
Medium md
: 1024px ~ 1439.99px
Large lg
: 1440px ~ 1919.99px
Extra Large xl
: 1920px ~ Infinity
Media Query λ₯Ό μ΄μ©ν΄ max-width: 500px
μΌ λ μ¦, 0~500px μΌ κ²½μ° red μμμΌλ‘ μ μ©
< div class ="target "> </ div >
< style lang ="scss " scoped >
.target {
height : 200px ;
background-color: $dark;
}
@media (max-width : 500px ) {
.target {
height : 200px ;
background-color: $red;
}
}
</ style >
Quasar λ Breakpoints λ₯Ό Sass λ³μλ‘ μ μν¨
μ΄ λ³μλ₯Ό μ΄μ©ν΄ max-width: 599.99px
λ‘ μ μλ μ μμ
@media (max-width: $breakpoint- xs- max) {
.target {
height : 200px ;
background-color: $red;
}
}
9-3. body μ μ μ©νκΈ°
framework: {
config : {
screen : {
bodyClasses : true // <<< add this
}
}
}
F12 κ°λ°μ λꡬμμ body νκ·Έμ νλ©΄ μ¬μ΄μ¦ λ³λ‘ class κ°μ΄ λ€μ΄κ°λ κ²μ λ³Ό μ μμ (screen--md
)
9-4. body μ¬μ΄μ¦μ λ§μΆ° μ€νμΌ μ μ©
body μ screen--sm
ν΄λμ€κ° μμΌλ©΄, .target
μ λ°°κ²½μμ yellow-3 컬λ¬λ‘ μ μ©
< div class ="target "> </ div >
< style lang ="scss " scoped >
.target {
height : 200px ;
background-color: $dark;
}
@media (max-width: $breakpoint- xs- max) {
.target {
height : 200px ;
background-color: $red;
}
}
.target {
body .screen--sm & {
background-color : $yellow-3 ;
}
body .screen--xs & {
background-color : $teal-3 ;
}
}
</ style >
κ²°κ³Όλ μλμ κ°μ
κΈ°λ³Έ μνλ $dark
/ screen--sm
μΌ λ $yellow-3
/ screen--xs
μΌ λ $teal-3
body.screen--xs & { ~
λΆλΆμ΄ μλ€λ©΄ media (max-width: $breakpoint-xs-max)
λ‘ μΈν΄ $red
κ° μ μ©λ¨
Breakpoints λ₯Ό νλ‘κ·Έλλ°μ μΌλ‘ μ κ·Ό
Options & Helpers > The $q object (https://quasar.dev/options/the-q-object )
$q.version, $q.platform, $q.screen, $q.lang, $q.iconSet, $q.cordova, $q.capacitor
screen μ λν μ 보λ€μ λ΄κ³ μμ
<template>
μμ μ κ·Ό μμλ <div>{{ $q.screen }}</div>
λ‘ μμ±νμ¬ screen μ 보λ₯Ό μ‘°νν μ μμ
$q object κ° vue μΈμ€ν΄μ€μ μκΈ° λλ¬Έ
Options API μ¬μ©νλ κ²½μ°, this.$q.screen
λ‘ μμ±
< script >
export default {
mounted ( ) {
console . log ( 'this.$q.screen > ' , this . $q . screen ) ;
} ,
} ;
</ script >
Vue 3 μ΄λ―λ‘, setup ν¨μμμ μ κ·ΌνκΈ°λ‘ ν¨
Quasar μμ μ§μνλ useQuasar
λΌλ Composable ν¨μλ₯Ό νμ©
< script setup >
import { useQuasar } from 'quasar' ;
const $q = useQuasar ( ) ;
console . log ( 'setup -> q.screen > ' , $q . screen ) ;
</ script >
9-7. Vue νμΌ μΈλΆμμ μ κ·Ό
import { Quasar , Platform } from 'quasar'
console . log ( Quasar . version )
console . log ( Platform . is . ios )
9-8. $q.screen κ°μ²΄ μΆλ ₯
$q.screen
κ°μ²΄λ₯Ό v-for
λ₯Ό μ΄μ©ν΄ λ°λ³΅νλ©° μΆλ ₯
v-for="(value, key) in $q.screen"
: $q.screen
μ κ°μ value, key μ λ΄μ
<span class="inline-block" style="width: 120px">
<span>
νκ·Έλ inline element λΌ width, height κ° μ μ©λμ§ μμ
Quasar μμ μ 곡νλ Helper Class λ₯Ό νμ©, inline blockμΌλ‘ display μμ± λ³κ²½
{{ isFunction(value) ? 'ν¨μ' : value }}
: ν¨μμ΄λ©΄ 'ν¨μ', μλλ©΄ value κ°μ μΆλ ₯νλλ‘ isFunction()
ν¨μ μμ±
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> $q.screen</ div >
< q-separator class ="q-my-md " />
< div class ="text-subtitle1 ">
< ul >
< li v-for ="(value, key) in $q.screen " :key ="key ">
< span class ="inline-block " style ="width: 120px "> {{ key }}</ span >
: < span > {{ isFunction(value) ? 'ν¨μ' : value }}</ span >
</ li >
</ ul >
</ div >
</ section >
< script setup >
const isFunction = value => typeof value === 'function' ;
</ script >
μΆλ ₯λ μ 보λ₯Ό μ΄μ©ν΄, νμ¬ νλ©΄μ΄ sm λ³΄λ€ ν¬λ©΄ μ€μ μ λ ¬λ $q.screen.name
λ₯Ό μΆλ ₯, μλλ©΄ 보μ΄μ§ μμ
name: sm
: νμ¬ νλ©΄μ λν Breakpoint μ 보 = sm
gt: { "xs": true, "sm": false, "md": false, "lg": false }
: νμ¬ νλ©΄μ λν Breakpoint μ 보μ λΉκ΅νμ¬ ν°μ§ κ²μ¬
< section class ="q-mb-xl ">
< div class ="text-h4 nanumBrush "> $q.screen κ³Ό v-if</ div >
< q-separator class ="q-my-md " />
< div v-if ="$q.screen.gt.sm " class ="target flex flex-center ">
< span class ="text-h2 text-weight-bold text-grey ">
{{ $q.screen.name }}
</ span >
</ div >
</ section >
framework : {
cssAddon : true ,
config : {
screen : {
bodyClasses : true , // <<< add this
} ,
} ,
μ¬λ°± μ§μ ν΄λμ€ μ¬μ΄μ Breakpoints μ€μ κ°λ₯ : .q-(p|m)(t|r|b|l|a|x|y)-<bp>-(none|auto|xs|sm|md|lg|xl)
ex. μΉ νλ©΄μμλ μ¬λ°±μ λκ², λͺ¨λ°μΌ νλ©΄μμλ μ¬λ°±μ μ’κ² μ€μ νκ³ μΆμ λ
<q-page class="q-pa-xl">
λμ <q-page class="q-pa-md q-pa-md-xl">
μνμ’μ° padding κ°μ΄ md μ΄μμ Breakpoints μμ xl μ΄κ³ , κ·Έ λ―Έλ§μΌ κ²½μ° md
< template >
< q-page class ="q-pa-md q-pa-md-xl ">
< section class ="q-mb-xl ">