1. 程式人生 > >跟著截圖10個環節順利用npm vue-cli(腳手架)搭建屬於自己的vue專案環境

跟著截圖10個環節順利用npm vue-cli(腳手架)搭建屬於自己的vue專案環境

       
        
  通過以上四步,我們需要準備的環境和工具都準備好了
5.接下來就開始使用vue-cli來構建專案:
     5.1 通過DOS命令進入存放專案的目錄
     
     5.2在該目錄下安裝專案依賴:安裝vue腳手架輸入:vue init webpack exprice ,注意這裡的“exprice” 是專案的名稱可以說是隨便的起名,但是需要主要的是“不能用中文”。
     $ vue init webpack exprice --------------------- 這個是那個安裝vue腳手架的命令
This will install Vue 2.x version of the template. ---------------------這裡說明將要建立一個vue 2.x版本的專案
For Vue 1.x use: vue init webpack#1.0 exprice
? Project name (exprice) ---------------------專案名稱:必填且英文名稱

? Project name exprice
? Project description (A Vue.js project) ---------------------專案描述:可忽略
? Project description A Vue.js project
? Author Datura --------------------- 專案建立者:可忽略
? Author Datura
? Vue build (Use arrow keys)
? Vue build standalone
? Install vue-router? (Y/n) 
? Install vue-router? Yes  --------------------- 是否安裝Vue路由,選擇yes(頁面路由跳轉會用到)

? Use ESLint to lint your code? (Y/n) n 
? Use ESLint to lint your code? No  ---------------------是否啟用eslint檢測規則,這裡個人建議選no(否則開發時,報錯會非常多,嚴格模式開發另說)
? Setup unit tests with Karma + Mocha? (Y/n)
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? (Y/n)
? Setup e2e tests with Nightwatch? Yes
vue-cli · Generated "exprice".
To get started: --------------------- 這裡說明如何啟動這個服務
cd exprice
npm install
npm run dev