准备

  1. 安装淘宝 npm镜像

    npm install -g cnpm --registry=https://registry.npm.taobao.org
  2. 添加系统变量path的内容

    因为cnpm会被安装到D:\Program Files\nodejs\node_global下,而系统变量path并未包含该路径。在系统变量path下添加该路径即可正常使用cnpm。

    cnpm -v

    npm install -g @vue/cli

    查看版本(是否安装成功):vue -V

创建一个项目

vue create project-name

还原项目 在根目录 cnpm install

Vue CLI v3.5.1
┌───────────────────────────┐
│ Update available: 3.9.3 │
└───────────────────────────┘
? Please pick a preset: (Use arrow keys)
> default (babel, eslint)
Manually select features

选择第二个

Vue CLI v3.5.1
┌───────────────────────────┐
│ Update available: 3.9.3 │
└───────────────────────────┘
? Please pick a preset: Manually select features
? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? 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

这里既然选择了typescript为什么还要用babel,这里是希望使用babel的编译功能,ts生成es6代码,再经过babel编译成es5代码;

选择需要插件 使用空格选择,回车进行下一步

? Check the features needed for your project: Babel, TS, Router, Vuex, CSS Pre-processors, Linter
? Use class-style component syntax? Yes
? Use Babel alongside TypeScript for auto-detected polyfills? Yes
? Use history mode for router? (Requires proper server setup for index fallback in production) Yes
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): (Use arrow keys)? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default):
> Sass/SCSS (with dart-sass) //注意选这个 最新版本都用这个实现了,用node-sass容易被墙
Sass/SCSS (with node-sass)
Less
Stylus
----------回车--------------
? Pick a linter / formatter config: TSLint
----------回车-----------------
? 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 package.json(选择把配置文件放在一个文件里)
? Save this as a preset for future projects? (y/N) n 等待安装完成 � Generating README.md... � Successfully created project admin.
� Get started with the following commands: $ cd admin
$ npm run serve 结束

VSCode 内置格式化插件导致代码格式化会自动换行问题,解决办法

1、设置

2、搜索 vetur

3、右边三个点按钮,-> open settings.json

添加以下代码:

"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "auto"
},
"prettyhtml": {
"printWidth": 200,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
}

vue2.0 创建项目的更多相关文章

  1. cocos2d-x 3.0 创建项目

    cocos2d-x 3.0 创建项目  点击打开链接

  2. 使用vue2.0创建的项目的步骤

    1.由于vue项目依赖 node.js npm 需要先安装.   若没有请先安装,请百度 //检查是否有node.js  npm vue win+r   输入cmd  输入node -v  回车 会出 ...

  3. Node + Express + vue2.0 + Webpack项目实践

    技术 Express.Vue.Vue-Router.Vue-Resource.Webpack Vue vue 的组件化思想和 React 很像,一个 vue 组件将 html.css 和 js 都写在 ...

  4. vue2.0 练习项目-外卖APP(1)

    前言 vue这个框架现在挺流行的,作为一个专注前端100年的代码爱好者,学习下路径流行的框架是必须的!在网上搜索vue的项目是比较少的,在官网进行了入门学后,没有一个项目练习巩固下,学了就等于没学,所 ...

  5. vue cli 3.0创建项目

    .npm i -g @vue/cli .vue create my-project 此处有两个选择: 1.default (babel, eslint)默认套餐,提供babel和eslint支持 2. ...

  6. 第一步 使用sencha touch cmd 4.0 创建项目、打包(加入全局变量、公用类、自定义扩展、资源文件)

    参考资料: http://www.cnblogs.com/qqloving/archive/2013/04/25/3043606.html http://www.admin10000.com/docu ...

  7. cocos2d-x-3.0创建项目

    之前一直用的是cocos2d-x-2.3版本号,使用tools里面的create-project.py脚本能够非常方便的创建项目.今天更新为3.0后,发现新版创建项目的方式有了非常大的改变,于是在这里 ...

  8. Vue2.0+Webpack项目环境构建到发布

    前言:为什么要用webpack搭建项目呢,因为这个工具可以把目前浏览器不全部支持的ES6语法,通过打包工具生成所有浏览器都支持的单个JS文件. 参考: https://blog.csdn.net/u0 ...

  9. 基于vue2.0搭建项目流程

    搭建vue2.0项目--myproject 一. 环境搭建: 1 打开命令行(cmd) 2 安装node node官网 3 安装 vue-cli步骤如下: npm install -g vue-cli ...

随机推荐

  1. 实现API优先设计的重要性和实现方式

    应用API优先的方法意味着设计API时,使其具有一致性和适应性,无论应用于哪些开发项目.对API使用API​​描述语言(如OpenAPI)是关键,因为它有助于建立API与其他程序通信的枢纽,即使这些系 ...

  2. Rikka with Game[技巧]----2019 杭电多校第九场:1005

      Rikka with Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Othe ...

  3. 集合系列 List(三):Vector

    Vector 的底层实现以及结构与 ArrayList 完全相同,只是在某一些细节上会有所不同.这些细节主要有: 线程安全 扩容大小 线程安全 我们知道 ArrayList 是线程不安全的,只能在单线 ...

  4. Java并发编程知识点总结Volatile、Synchronized、Lock实现原理

    Volatile关键字及其实现原理 在多线程并发编程中,Volatile可以理解为轻量级的Synchronized,用volatile关键字声明的变量,叫做共享变量,其保证了变量的“可见性”以及“有序 ...

  5. Python笔记_初级语法

    1.标识符与变量 1.1 标识符 规范 只能由数字,字母,_(下划线)组成 不能以数字开头 不能是关键字 区分大小写 命名约束 下划线分隔法(推荐): 多个单词组成的名称,使用全小写字母书写,中间使用 ...

  6. Spark应用监控解决方案--使用Prometheus和Grafana监控Spark应用

    Spark任务启动后,我们通常都是通过跳板机去Spark UI界面查看对应任务的信息,一旦任务多了之后,这将会是让人头疼的问题.如果能将所有任务信息集中起来监控,那将会是很完美的事情. 通过Spark ...

  7. 王某人从0开始学习lorawan的笔记_1:最底层!IO驱动层,Gpio_t类

    本来想介绍SX1276(与SX1278的操作完全相同,只是需要处理频段)的,但是这款芯片内容还是很丰富的,三言两语介绍不清,而且资料也很多就算了. 直接正面怼lorawan吧,怼到高地去,打爆lora ...

  8. 10_switch语句的使用

    /* switch 语句和c语言的用法不同 1.go语句是默认添加break语句的,但c不是默认的 2.go语句添加一个fallthrough语句,可以顺序执行接下来的结构 3.switch在关键词后 ...

  9. 域渗透-LSA Protection

    简介: 微软在 2014 年 3 月 12 日添加了 LSA 保护策略,用来防止对进程 lsass.exe 的代码注入,这样一来就无法使用 mimikatz 对 lsass.exe 进行注入,相关操作 ...

  10. JS之clientWidth、offsetWidth等属性介绍

    一.clientXXX 属性 代码演示 // css 部分 <style> .test{ width:100px; height:100px; border:1px solid red; ...