1. 程式人生 > >建立Vue專案並且使用Idea開發工具開啟

建立Vue專案並且使用Idea開發工具開啟

node -v   // 檢視node版本
npm -v    // 檢視vue版本
npm i -g cnpm --registry=https://registry.npm.taobao.org

安裝腳vue腳手架

cnpm i -g vue-cli

測試是否安裝成功

vue -V

進入工作目錄:F:\ZZ\Myprojects  該目錄下有資料夾Java,然後按住Shift鍵不放點選滑鼠右鍵選擇“在此處開啟命令視窗”,此時命令視窗自動在java資料夾下,在命令視窗執行,如下

// vue_springboot_gradle_jpa_postgresql是專案名,可自定義
vue init webpack vue_springboot_gradle_jpa_postgresql

命令解釋如下

提示目錄已存在,是否繼續:Y
Project name(工程名):回車
Project description(工程介紹):回車
Author:作者名
Vue build(是否安裝編譯器):回車
Install vue-router(是否安裝Vue路由):Y
Use ESLint to lint your code(是否使用ESLint檢查程式碼,我們使用idea即可):Y
Set up unit tests(安裝測試工具):Y
Setup e2e tests with Nightwatch(也是測試相關):Y
Should we run `npm install` for you after the project has been created? (recommended):選擇:

最後一項是問建立完之後是否執行npm install,自己根據情況自行Y或n回車

然後使用Idea開啟該專案,操作步驟如下

選擇專案檔案根目錄,點選OK

之前執行過npm install 專案下會出現 node_modules資料夾,若沒有,先在terminal視窗下執行cnpm install,此時便有了node_modules資料夾(以下突變已經執行過)

 然後執行npm run dev

出現Your application is running here: http://localhost:8080說明啟動成功