一準備:vue
在F:/xampp/htdocs/文件夾下檢查:node
1,node -v;webpack
2,npm -v;web
3,淘寶鏡像(選裝):vue-router
npm install -g cnpm --registry= https://registry.npm.taobao.orgvue-cli
cnpm -vnpm
4,安裝webpack;網絡
npm install webpack -g架構
webpack -v;vue-resource
5,安裝vue-cli腳手架構建工具;
npm install vue-cli -g;
vue -V (注意是大寫的V);
二:使用vue-cli構建項目:
1,安裝vue腳手架:
$ vue init webpack exprice --------------------- 這個是那個安裝vue腳手架的命令,「exprice」 是項目自定義的名稱 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) --------------------- 是否安裝Vue路由,也就是之後是spa(但頁面應用須要的模塊) ? Install vue-router? Yes ? Use ESLint to lint your code? (Y/n) n ---------------------是否啓用eslint檢測規則,這裏我的建議選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: --------------------- 這裏說明如何啓動這個服務 cd exprice npm install npm run dev
2,cd exprice-->npm install;
3,安裝 vue 路由模塊 vue-router 和網絡請求模塊 vue-resource
cnpm install vue-router vue-resource --save
4,npm run dev;
三,目錄說明:
總結:
參考地址:
http://www.jianshu.com/p/1626b8643676