前端開發使用vue腳手架快速構建前端專案
一、使用步驟
Vue 提供了一個官方的 CLI,為單頁面應用 (SPA) 快速搭建繁雜的腳手架,
1.配置node環境
前往node官網下載并安裝,地址https://nodejs.org/zh-cn/;
& node -v 檢測是否安裝成功
2.下載安裝vue官方腳手架
npm install -g @vue/cli
& vue --version 檢測是否安裝成功
3.通過cd命令進入你想要創建專案的檔案夾
& vue init webpack 檔案夾名稱
運行該命令后接著出現下列選項:
-
如果當前檔案夾已存在,會提示Target directory exists. Continue? Yes
是否在當前目錄下創建 -
Project name -- vueproject
專案名稱 -
Project description -- A Vue.js project
專案描述 -
Author (wanghong <535952925@qq.com>) wh
作者 -
Vue build
Runtime + Compiler: recommended for most users --運行加編譯(建議選擇)
Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY allowed in .vue files - render functions are required elsewhere --僅運行
-
Install vue-router? (Y/n) y
是否安裝路由 -
Use ESLint to lint your code? (Y/n) y
是否使用ESLint管理代碼,ESLint是個代碼風格管理工具,是用來統一代碼風格的,并不會影響整體的運行,看個人專案需求 -
Set up unit tests (Y/n)
是否設定單元測驗
-
Setup e2e tests with Nightwatch (Y/n)
是否設定端到端測驗
-
Should we run `npm install` for you after the project has been created? (recommended) (Use arrow keys)
Yes, use NPM (使用npm包管理)
Yes, use Yarn (使用yarn包管理)
No, I will handle that myself (自己處理)
4.專案初始化成功
# Project initialization finished!
cd work(進入專案所在檔案夾)
& npm run dev 啟動專案
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/179071.html
標籤:AI
上一篇:初次體驗Vagrant
