ရိုးရိုးလေး ရှင်းပြမယ်
Create a Vue Project with Vite ကို ရိုးရိုးလေးနားလည်မယ်
Node.js ထည့်သွင်းပြီး terminal မှ create-vue ကို run ပါ။ Project option များထဲမှ Vue Router, Pinia နှင့် testing ကို လိုအပ်သလိုရွေးနိုင်သည်။ src/App.vue က root component ဖြစ်ပြီး src/main.js က app ကို စတင်သည့် entry file ဖြစ်သည်။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
npm install မလုပ်ခင် dev server စတင်ခြင်း
ဖြစ်လေ့ရှိတဲ့အမှား
Terminal ကို project directory အပြင်ဘက်တွင် run ခြင်း
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
Official create-vue scaffolding ကိုအသုံးပြုပြီး Vite အခြေခံ Vue 3 project တစ်ခုဖန်တီးမည်။
- Props / event
- Component + template
- Rendered Vue UI
Vue project ဖန်တီးရန်
အဓိက Syntax / Pattern
npm create vue@latest
cd my-vue-app
npm install
npm run devOfficial create-vue scaffolding ကိုအသုံးပြုပြီး Vite အခြေခံ Vue 3 project တစ်ခုဖန်တီးမည်။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Props / event
npm create vue@latestNode.js ထည့်သွင်းပြီး terminal မှ create-vue ကို run ပါ။ Project option များထဲမှ Vue Router, Pinia နှင့် testing ကို လိုအပ်သလိုရွေးနိုင်သည်။ src/App.vue က root component ဖြစ်ပြီး src/main.js က app ကို စတင်သည့် entry file ဖြစ်သည်။
- Component + template
npm installOfficial create-vue scaffolding ကိုအသုံးပြုပြီး Vite အခြေခံ Vue 3 project တစ်ခုဖန်တီးမည်။
- Rendered Vue UI
npm run devCreate a Vue Project with Vite ကို example အသေးတစ်ခုနဲ့စပြီး normal, edge နဲ့ failure cases ကိုစစ်ပါ။
- Props / event
- Component + template
- Rendered Vue UI
Success
Vue project ဖန်တီးရန်
Failure
npm install မလုပ်ခင် dev server စတင်ခြင်း
ရိုးရိုးလေး ရှင်းပြမယ်
Node.js ထည့်သွင်းပြီး terminal မှ create-vue ကို run ပါ။ Project option များထဲမှ Vue Router, Pinia နှင့် testing ကို လိုအပ်သလိုရွေးနိုင်သည်။ src/App.vue က root component ဖြစ်ပြီး src/main.js က app ကို စတင်သည့် entry file ဖြစ်သည်။
npm create vue@latest
cd my-vue-app
npm install
npm run devLocal: http://localhost:5173/လက်တွေ့စမ်းကြည့်ရန်
Project အသစ်တစ်ခုဖန်တီးပြီး App.vue ထဲရှိ heading ကို “My Vue Lab” ဟု ပြောင်းပါ။
Vue Quick Start — Vue.js
Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Create a Vue Project with Vite ကို example အသေးတစ်ခုနဲ့စပြီး normal, edge နဲ့ failure cases ကိုစစ်ပါ။
Mini challenge
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Project အသစ်တစ်ခုဖန်တီးပြီး App.vue ထဲရှိ heading ကို “My Vue Lab” ဟု ပြောင်းပါ။
- Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
- Normal input နဲ့ edge case စမ်းပါ
- Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
npm create vue@latest
cd my-vue-app
npm install
npm run devရလဒ်: Vue project ဖန်တီးရန်
အရိပ်အမြွက် ကြည့်ရန်
Create a Vue Project with Vite ကို example အသေးတစ်ခုနဲ့စပြီး normal, edge နဲ့ failure cases ကိုစစ်ပါ။
Quick Quiz 1 / 3
Quick Quiz 2 / 3
Quick Quiz 3 / 3
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- Props / event → Component + template → Rendered Vue UI
- Official create-vue scaffolding ကိုအသုံးပြုပြီး Vite အခြေခံ Vue 3 project တစ်ခုဖန်တီးမည်။
- npm install မလုပ်ခင် dev server စတင်ခြင်း
- Create a Vue Project with Vite ကို example အသေးတစ်ခုနဲ့စပြီး normal, edge နဲ့ failure cases ကိုစစ်ပါ။
Vue Quick Start — Vue.js