先初始化一個(gè)vue2.0項(xiàng)目
1、安裝vue-cli:
npm install -g @vue/cli
可以輸入vue -V查看版本
vue -V
現(xiàn)在安裝下來的話是@vue/cli 4.3.1版本
2、初始化 vue 項(xiàng)目:
vue create 你的項(xiàng)目名稱
確認(rèn)后:我們選擇Manually select feature手動
Please pick a preset:
default (babel, eslint) //自動
? Manually select features //手動
隨后勾選我們開發(fā)常用的:Router、Vuex、CSS Pre-processors 和 Linter / Formatter,
Vue CLI v4.3.1
? Please pick a preset: Manually select features
? Check the features needed for your project:
? Babel
? TypeScript
? Progressive Web App (PWA) Support
? Router
? Vuex
? CSS Pre-processors
?? Linter / Formatter
? Unit Testing
? E2E Testing
然后是否使用history router:選擇Y就好
? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) Y
css預(yù)處理器:我常選擇Less
Sass/SCSS (with dart-sass)
> Sass/SCSS (with node-sass)
Less
Stylus
ESLint:一個(gè)插件化的javascript代碼檢測工具,ESLint + Prettier //使用較多
ESLint with error prevention only
ESLint + Airbnb config
ESLint + Standard config
> ESLint + Prettier
何時(shí)檢測:
>(*) Lint on save
( ) Lint and fix on commit
如何存放配置 :
In dedicated config files
> In package.json
是否保存本次配置:Y
? Save this as a preset for future projects? (y/N)
然后運(yùn)行即可
npm run serve

初始的vue項(xiàng)目