vue-cli 3.0安装详解

全局安装@vue/cli
npm install -g @vue/cli

创建新项目
vue create project-name

1、是否使用淘宝镜像(淘宝镜像可以加快安装速度)

2、选择预设(默认/手动选择特性)

默认包含了基本的 Babel + ESLint 设置的预设

手动选择特性:

Babel:转码器,可以把ES6代码转为ES5代码

TypeScript:JavaScript的一个超集(添加了可选的静态类型和基于类的面向对象编程:类型批注和编译时类型检查、类、接口、模块、lambda 函数)

Progressive Web App (PWA) Support:渐进式Web应用程序

Router:Vue路由

Vuex:Vue的状态管理

CSS Pre-processors:CSS预处理器

Linter / Formatter:代码风格检查和格式化

Unit Testing:单元测试

E2E Testing:E2E测试

根据自己的项目需要配置自己的预设,回车之后更加详细的配置自己选择的预设。

Vue CLI v3.9.3
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, Router, Vuex, CSS Pre-processors, Linter

// 路由是否选择history模式
? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) n

// css预处理器
?Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default):
  Sass/SCSS (with dart-sass)
  Sass/SCSS (with node-sass)
> Less
  Stylus

// 代码检测工具
? Pick a linter / formatter config:
  ESLint with error prevention only
  ESLint + Airbnb config
  ESLint + Standard config
> ESLint + Prettier

// 何时检测
? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection)
>(*) Lint on save
 ( ) Lint and fix on commit

// 如何存放配置
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.?
  In dedicated config files
> In package.json

// 是否保存这次预设
? Save this as a preset for future projects? (y/N) y

// 预设名字
? Save preset as: test

3、启动项目

安装完依赖

 $ cd project-name
 $ npm run serve

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值