1
npm install -g @vue/cli

创建配置

创建

1
vue create vue-app

选择配置

1
2
3
4
? Please pick a preset: (Use arrow keys)
1 (babel, eslint)
default (babel, eslint)
Manually select features
  • 保存过的配置
  • 默认配置
  • 自定义配置

自定义配置

1
2
3
4
5
6
7
8
9
10
? 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

可以直接按数字键1,2,3,4进行选择

  • Babel:将ES6编译成ES5
  • TypeScript:JS超集,主要是类型检查
  • Router和Vuex,路由和状态管理
  • Linter/ Formatter:代码检查工具
  • CSS Pre-processors:css预编译 (稍后会对这里进行配置)
  • Unit Testing:单元测试,开发过程中前端对代码进行自运行测试
1
Use class-style component syntax? (Y/n) y

是否使用Class风格装饰器?
即原本是:home = new Vue()创建vue实例
使用装饰器后:class home extends Vue{}

大专栏  vue-cli3初始化项目ass="gutter">
1
Use Babel alongside TypeScript for auto-detected polyfills? (Y/n) y

使用Babel与TypeScript一起用于自动检测的填充? yes

1
Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) y

路由使用历史模式? 这种模式充分利用 history.pushState API 来完成 URL 跳转而无须重新加载页面

1
2
3
4
5
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): (Use arrow keys)
Sass/SCSS (with dart-sass)
Sass/SCSS (with node-sass)
Less
Stylus

使用什么css预编译器? 看个人习惯

1
2
3
4
5
6
? 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…: 严格模式;

建议选择正常模式

1
2
3
? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection)
(*) Lint on save
( ) Lint and fix on commit

代码检查方式

  • 保存时检查
  • 提交时检查并修复

启动打包配置

可以在项目最外层新建vue.confi.js来配置端口,代理等配置,具体可以参照官方文档

vue-cli3初始化项目的更多相关文章

  1. 一步步建立 Vue + Cesium 初始化项目

    一步步建立 Vue + Cesium 初始化项目 初始化 Vue 项目 升级 npm npm install -g npm 安装 @vue/cli 和 @vue/cli-service-global ...

  2. 在 vue cli3 的项目中配置双服务,模拟 ajax 分页请求

    最近安装了下vue cli3版本,与 cli 2 相比,文件少了,以前配置方法也不管用了.demo 中的大量的数据,需要做成 ajax 请求的方式来展示数据,因此,需要启动两个服务,一个用作前端请求, ...

  3. vue + element + 初始化项目

    前提:已经安装了好了npm 和 vue脚手架 注意: 进入想要放置项目的目录下. 1.vue init webpack sun-vue-element 2.根据提示输入 y/n 3.npm run d ...

  4. vue --- 脚手架初始化项目中配置文件webpack.base.conf.js代码含义

    'use strict' //引入node path 中间件 可以获取到 path 路径的一些信息 const path = require('path') //引入utils工具模块 utils主要 ...

  5. vue cli3 创建项目

    1.确认是否由安装由vue 命令提示符 执行 vue -V 如果没有则执行 npm uninstall vue-cli 2.创建项目 vue create demo1 具体操作如下: (1)执行以上命 ...

  6. vue init初始化项目后 npm run dev报错 10% building modules 1/1 modules 0 activeevents.js:182 throw er; // Unhandled 'error' event

    报错信息: 10% building modules 1/1 modules 0 activeevents.js:182       throw er; // Unhandled 'error' ev ...

  7. Vue CLI3 关闭热替换后出现的warning

    用vue cli3做项目的时候如果开启了typescript的严格模式,在dev server热替换的时候往往就会打出一大堆warning,严重的影响了编译效率.官方并没有提供关闭warning的ap ...

  8. 利用node、express初始化项目

    前端做整站是开发,例如:前端是用了vue创建初始化项目,后端我们不会php.java等,我们只能用node去创建去做后端代码,本文就给大家讲解最基础的从零开始创建一个项目的后端环境. 一般来说前后端代 ...

  9. vue_webpack初始化项目

    整体架构:此处npm安装过于缓慢,因此使用的是淘宝的镜像cnpm vue+webpack 初始化项目:1.安装vue: cnpm install vue 检验版本: vue -V2.创建一个vue项目 ...

  10. vue cli3 项目配置

    [转]https://juejin.im/post/5c63afd56fb9a049b41cf5f4 基于vue-cli3.0快速构建vue项目 本章详细介绍使用vue-cli3.0来搭建项目. 本章 ...

随机推荐

  1. 寒假day12

    今天写了一点论文,刷了一些算法题

  2. protobuf 的enum与string转换

    c/c++ enum 介绍 说起c/c++ 的enum,比起python 真的是方便简洁 enum type{ type1 = 0, type2 } enum的元素对应的int 默认从0 开始依次增加 ...

  3. matlab 高级

    绘图 条形图 x = [1:10]; y = [75, 58, 90, 87, 50, 85, 92, 75, 60, 95]; bar(x,y), xlabel('Student'),ylabel( ...

  4. vue中在时间输入框中默认显示时间

    <template> <card> <label>开始时间</label> <DatePicker v-model="startTime ...

  5. win10开发环境下安装mongodb

    MongoDB 下载 https://www.mongodb.com/download-center/community 在win10系统安装mongodb需要vc++运行库,如果没有则会提示“无法启 ...

  6. WEB网站的favicon.ico的设置

    一.什么是favicon.ico Favicon是Favorites Icon的缩写,favicon.ico是指显示在浏览器收藏夹和地址栏网站网址前面的个性化图标,常被成为网页小图标.网站缩略图标或者 ...

  7. deque & list

    deque 双向队列 它也是采用动态数组的方式来管理的提供了随机数组 和vector的区别 1.deque头尾两端可以开放,能够进行快速的插入和删除(vector只能在尾部进行快速的插入和删除) 2. ...

  8. JVM(三)内存结构图

    JVM内存结构图:

  9. 93.QuerySet转换为SQL的条件:迭代,切片(指定步长),len函数,list函数,判断

    生成一个QuerySet对象并不会马上转换为SQL语句去执行. books = Book.objects.filter(pk=3) print(connection.queries) 打印出djang ...

  10. 163邮箱报错: 535 Error: authentication failed

    今天更换新的异常信息发件邮箱,重新申请了一个新邮箱,SMTP功能已经开通,调用java代码报异常,错误信息为:535 Error: authentication failed.经过网上查证,原来新的1 ...