1. 選擇預設
Vue CLI v4.5.12
? Please pick a preset:
Default ([Vue 2] babel, eslint)
Default (Vue 3 Preview) ([Vue 3] babel, eslint)
Manually select feature # 手動選擇功能
2.選擇 Manually select features創建
Vue CLI v4.5.12
? Please pick a preset: Manually select features
? Check the features needed for your project:
(*) Choose Vue version
(*) Babel
( ) TypeScript
( ) Progressive Web App (PWA) Support
( ) Router
( ) Vuex
( ) CSS Pre-processors
(*) Linter / Formatter
( ) Unit Testing
( ) E2E Testing
- babel,可將ES6語法轉成ES5語法。
- TypeScript,TypeScript通過添加類型來擴展JavaScript。通過了解JavaScript,TypeScript可以節省您捕獲錯誤的時間並在運行代碼之前提供修復。任何瀏覽器,任何操作系統,任何運行JavaScript的地方。 完全開源。
- Progressive Web App (PWA) Support,漸進式Web應用程序(PWA)支持。
- Vuex,一個專為 Vue.js 應用程序開發的狀態管理模式。它采用集中式存儲管理應用的所有組件的狀態,並以相應的規則保證狀態以一種可預測的方式發生變化。
- CSS Pre-processors,CSS預處理器,預處理器:比如要用sass或者cssNext就要按照人家規定的語法形式,就是用人家的語法去編寫,然后人家把你編寫的代碼轉成css。
- Linter / Formatter,格式化程序。
- Unit Testing,單元測試。
- E2E Testing,端到端(end-to-end)。
2.1 Use history mode for router
2.2 Choose Vue version
2.3 Pick a linter / formatter config
? Pick additional lint features:
ESLint with error prevention only
ESLint + Airbnb config
ESLint + Standard config
ESLint + Prettier
- ESLint with error prevention only,只配置使用 ESLint 官網的推薦規則。
- ESLint + Airbnb config,使用 ESLint 官網推薦的規則 + Airbnb 第三方的配置 Airbnb的規則。
- ESLint + Standard config,使用 ESLint 官網推薦的規則 + Standard第三方的配置 Standard 的規則。
- ESLint + Prettier,使用 ESLint 官網推薦的規則 +Prettier 第三方的配置 Prettier 主要是做風格統一。
? Pick additional lint features:
(*) Lint on save # 保存就檢測
( ) Lint and fix on commit # 提交時檢測
2.4 如何選擇配置
? Where do you prefer placing config for Babel, ESLint, etc.?
In dedicated config files # 存放到獨立文件中
In package.json # 存放到 package.json 中
2.5 選擇是否保存本次配置
Save this as a preset for future projects?
2.6 等待項目創建