vue 運行環境安裝與配置


1.安裝 Visual Studio Code

2.安裝 Node  查看版本:node -v

3.安裝 Git      查看版本:git --version

4.安裝cli

   npm install -g @vue/cli

   查看版本:vue -V

5.新建項目:vue create subject_name

? Please pick a preset: (Use arrow keys)  選擇預設

   Default ([Vue 2] babel, eslint)  默認2.0
   Default (Vue 3) ([Vue 3] babel, eslint)  默認3.0
> Manually select features 手動

   這里按鍵盤上下方向鍵選擇手動設置,回車

 

? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert selection)  選擇項目需要配置的功能:(按<空格鍵>選擇與取消,<a>切換全部,<i> 反轉選擇)

> (*) Choose Vue version  選擇vue版本
   (*) Babel  支持新特性語言,如 es6
   ( ) TypeScript  js超集
   ( ) Progressive Web App (PWA) Support  漸進式Web應用程序(PWA)支持
   (*) Router  路由器
   (*) Vuex  狀態管理
   (*) CSS Pre-processors  CSS預處理器
   (*) Linter / Formatter  格式化程序
   ( ) Unit Testing  單元測試(開發者角度)
   ( ) E2E Testing  端到端測試(用戶角度)

   這里一次性選完后回車開始逐步配置

 

? Choose a version of Vue.js that you want to start the project with (Use arrow keys)  選擇vue版本
> 2.x
   3.x

   這里選擇2.0版本

 

? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n)  對路由器使用歷史記錄模式? (需要適當的服務器設置,以便在生產中進行索引回退)(是/否)

    這里輸入Y回車(采用歷史路由模式地址欄才不會出現#)

 

? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default):  選擇css預編譯模式
   Sass/SCSS (with dart-sass)
   Sass/SCSS (with node-sass)
> Less
   Stylus

   這里選擇less,回車

 

? Pick a linter / formatter config:  選擇esLine代碼規范檢查級別
> ESLint with error prevention only  基本
   ESLint + Airbnb config  Airbnb編碼規則
   ESLint + Standard config  標准
   ESLint + Prettier  完美

   這里選擇基本,回車

 

? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection)  選擇esLine其他功能

> (*) Lint on save  保存的時候檢測
   ( ) Lint and fix on commit  提交git的時候檢測

   這里選擇直接保存,回車

 

? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)  您希望在哪里放置Babel,ESLint等的配置? (使用箭頭鍵)

   In dedicated config files  在專用配置文件中
> In package.json  在package.json中

   這里選擇把配置信息存在package.json中即可,回車

 

? Save this as a preset for future projects? (y/N)  將其另存為將來項目的預設嗎? (是/否)

   這里選N,不保存此次預設,回車項目新建中...

 

6.運行項目:npm run serve

 

7.打包項目:npm run build


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM