第一個 Vue 專案
以下使用 **Vite** 建立第一個 Vue 前端專案,並顯示 `Hello Vue`。
## 1. 建立 Vue 專案
先確認已安裝 Node.js,接著在終端機執行:
```bash
npm create vite@latest hello-vue
```
依序選擇:
```text
Framework: Vue
Variant: JavaScript
```
也可以直接使用指令建立:
```bash
npm create vite@latest hello-vue -- --template vue
```
## 2. 安裝相依套件
進入專案目錄:
```bash
cd hello-vue
```
安裝套件:
```bash
npm install
```
## 3. 修改畫面內容
開啟:
```text
src/App.vue
```
將內容修改為:
```vue
<template>
<h1>Hello Vue</h1>
</template>
```
## 4. 啟動開發伺服器
```bash
npm run dev
```
終端機會顯示類似:
```text
Local: http://localhost:5173/
```
使用瀏覽器開啟該網址,即可看到:
```text
Hello Vue
```
相關學習地圖、教學課程
F2E 網站前端工程