มาลองเล่น Vue CLI 3 กัน

เป็น Version 3 ของ vuejs ที่สามารถสร้าง template ได้อย่างรวดเร็วใช้งานง่าย มี ui ในการ Config ค่าต่างๆ (ไม่ได้มาขายของนะ)

Rachata Tongpagdee
Sep 6, 2018 · 2 min read

การติดตั้ง

  1. ติดตั้ง Node.js Version 8.9 ขึ้นไปแนะนำให้ใช้ 8.11.x สามารถจัดการ Node Version ได้จาก nvm หรือ nvm-for-window
  2. ถ้าหากมี vue version 2 อยู่แล้วให้ทำการ uninstall ออกก่อนโดยใช้คำสั่ง
& npm uninstall vue-cli -g

3. ติดตั้ง vue cli (ทำครั้งแรก)

& npm install -g @vue/cli

4. ทดสอบ

& vue --version

สร้าง Project

  1. ขึ้น Project เลย
& vue create <project-name>

2. รัน server ของ vue cli ขึ้นมา

& npm run serve

อย่างเฟี้ยววววว

3. ตัวอย่างโครงสร้างของ file

4. สามารถ Config ค่าต่างๆผ่าน ui ได้ด้วยสำหรับคนที่ไม่ชอบ cli

& vue ui
เปลี่ยน theme เป็นสีดำนะ(ล่างขวา)

5. เลือกติดตั้ง plugin ที่อยากใช้

6. เลือกติดตั้ง dependencies ได้ด้วย

7. Config ค่าต่างๆของ Project

8. Run server และคำสั่งอื่นๆได้ด้วยยย


Rachata Tongpagdee

Written by

Network KMUTNB

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade