vue-cli 3.0安装与使用

2019-05-26  本文已影响0人  散樱乱舞

默认你已经安装了node.js

1.安装
npm install -g @vue/cli
2.创建vue-app项目
vue create vue-app
3.创建项目会遇到的选项
Babel:将ES6编译成ES5
TypeScript:JS超集,主要是类型检查
Progressive Web App (PWA) Support:PWA
Router:路由管理
Vuex:状态管理
Linter/ Formatter:代码检查工具
CSS Pre-processors:css预编译
Unit Testing:单元测试,开发过程中前端对代码进行自运行测试

选择相应项目后,会询问详细配置

Use class-style component syntax? (Y/n) y

未使用:home = new Vue()
使用:class home extends Vue{}

Use Babel alongside TypeScript for auto-detected polyfills? (Y/n) y
Use history mode for router? (Y/n) y
Pick a CSS pre-processor: (Use arrow keys)
Sass/SCSS (with dart-sass)
Sass/SCSS (with node-sass)
Less
Stylus
Pick a linter / formatter config: (Use arrow keys)
TSLint
ESLint with error prevention only
ESLint + Airbnb config
ESLint + Standard config
ESLint + Prettier

tslint:typescript格式验证工具
eslint w...:只进行报错提醒;//选这个
eslint + A...:不严谨模式;
eslint + S...:正常模式;
eslint + P...:严格模式;

Pick additional lint features:
Lint on save
Lint and fix on commit

Lint on save:保存时检查
Lint and fix on commit:修改提交时检查

Pick a unit testing solution:
Mocha + Chai
Jest
Pick a E2E testing solution: 
Cypress (Chrome only)
Nightwatch (Selenium-based)
Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? 
In dedicated config files
In package.json

In dedicated config files:专用文件
In package.json:package.json里面 //一般来说选这个

Save this as a preset for future projects? (y/N)

保存:

Save preset as:

命名配置名称,以后可以直接使用这一次的配置

上一篇下一篇

猜你喜欢

热点阅读