-
檢測 node.js 和 npm 版本
$ node -v
v8.11.3
$ npm -v
5.6.0
-
安裝vue-cli腳手架工具
$ npm install -g vue-cli
-
新建vue-cli項目
$ vue init webpack my-project
vue init webpack my-project
$ vue init webpack exprice --------------------- 這個是那個安裝vue腳手架的命令
This will install Vue 2.x version of the template. ---------------------這里說明將要創(chuàng)建一個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 --------------------- 項目創(chuàng)建者
? Author Datura
? Vue build (Use arrow keys)
? Vue build standalone
? Install vue-router? (Y/n) --------------------- 是否安裝Vue路由,也就是以后是spa(但頁面應(yīng)用需要的模塊)
? Install vue-router? Yes
? Use ESLint to lint your code? (Y/n) n ---------------------是否啟用eslint檢測規(guī)則,這里個人建議選no
? Use ESLint to lint your code? 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: --------------------- 這里說明如何啟動這個服務(wù)
cd exprice
npm install
npm run dev
實際操作圖
image
打開文件目錄:cd exprice(這里是自己建工程的名字);
安裝項目依賴:npm install
運行:npm run dev