1、# 全局安裝 vue-cli
npm install vue-cli -g // 如果還沒安裝
2、# 創建一個基於 webpack 模板的新項目
vue init webpack myproject
2.1、參數設置說明:
Generate project in current directory:是否在當前目錄下生成項目
Project name 項目名稱
Project description 項目描述
Author :作者
下面的都是選擇部分
Vue build : 選 Runtime + Compiler: recommended for most users 運行加編譯(推薦大部分人使用);
Use ESLint to lint your code? (Y/n) 是否使用ESLint管理代碼,ESLint是個代碼風格管理工具,是用來統一代碼風格的,並不會影響整體的運行,這也是為了多人協作,新手就不用了,一般項目中都會使用。官網: http://eslint.org/
Pick an ESLint preset (Use arrow keys) :選擇編寫vue項目時的代碼風格,根據個人愛好選擇:
Standard ( https://github.com/feross/standard)
AirBNB ( https://github.com/airbnb/javascript)
none 自己定義風格
Setup unit tests with Karma + Mocha? (Y/n) 是否安裝單元測試
Setup e2e tests with Nightwatch(Y/n)? 是否安裝e2e測試
Generate project in current directory:是否在當前目錄下生成項目
Project name 項目名稱
Project description 項目描述
Author :作者
下面的都是選擇部分
Vue build : 選 Runtime + Compiler: recommended for most users 運行加編譯(推薦大部分人使用);
Use ESLint to lint your code? (Y/n) 是否使用ESLint管理代碼,ESLint是個代碼風格管理工具,是用來統一代碼風格的,並不會影響整體的運行,這也是為了多人協作,新手就不用了,一般項目中都會使用。官網: http://eslint.org/
Pick an ESLint preset (Use arrow keys) :選擇編寫vue項目時的代碼風格,根據個人愛好選擇:
Standard ( https://github.com/feross/standard)
AirBNB ( https://github.com/airbnb/javascript)
none 自己定義風格
Setup unit tests with Karma + Mocha? (Y/n) 是否安裝單元測試
Setup e2e tests with Nightwatch(Y/n)? 是否安裝e2e測試
3.啟動項目
npm run dev

4.項目打包
npm run build
會在項目目錄下生成 dist目錄
5.將dist文件夾拷貝到 tomcate/webapps/ROOT/目錄下
啟動tomcate bin/staratup.sh
6.就可以用瀏覽器訪問了