1.創建vue項目
1.node js 生成項目,編譯項目
2.hbuilder 開發環境
1.下載安裝node js
http://nodejs.cn/download/
?
確認是否安裝成功
?
如果安裝不了 代碼錯誤2503
解決方法:
管理員命令運行cmd;
cd\
cd C:\Users\Administrator\Desktop
msiexec/package node-v6.3.1-x64.msi
(msi是版本號)
2.安裝 VUE CLI?
vue cli 是一個腳手架工具,用于生成一個基礎的vue應用。
npm install vue-cli -g
3.新建一個Vue項目
cd 目錄(你要把項目放在哪個目錄)
vue init webpack pname(你的項目名字)
;? Project description (A Vue.js project) vue-cli新建項目(項目描述)
;? Author (xhdx <zhuming3834@sina.com>) ;zhuming3834@sina.com(項目作者)
;-
? 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
這里選擇Runtime + Compiler: recommended for most users; -
? Install vue-router? (Y/n) y 是否使用vue-router,這里根據需求選擇;
-
? Use ESLint to lint your code? (Y/n) y 是否使用ESLint,這里根據需求選擇;
-
? Pick an ESLint preset (Use arrow keys)
? Standard (https://github.com/feross/standard)
Airbnb (https://github.com/airbnb/javascript) none (configure it yourself) 這里選擇Standard (https://github.com/feross/standard) -
? Setup unit tests with Karma + Mocha? (Y/n) n 是否需要單元測試,這里根據需求選擇;
-
Setup e2e tests with Nightwatch? (Y/n) n是否需要單元測試,這里根據需求選擇;
-
cd pname(項目目錄);
-
npm install 安裝依賴
-
npm run dev 本地運行項目
?
?
?
?
?
?
?
?
?
?
?
?
?
默認瀏覽器會自動打開http://localhost:8080/#/
,出現如下頁面:?
一共13步,一個vue-cli新建的模板項目就運行起來了。