vue2.0 创建项目
准备
- 安装淘宝 npm镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org 添加系统变量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)LessStylus
----------回车--------------
? 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}}
转载于:https://www.cnblogs.com/sands/p/11284621.html
vue2.0 创建项目相关推荐
- vue2.0创建项目步骤
一.介绍 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统.有三个组件: CLI :@vue/cli 全局安装的 npm 包,提供了终端里的vue命令(如:vue create .vu ...
- Vue2脚手架创建项目
Vue2脚手架创建项目 一.使用脚手架 1.安装 @vue/cli 简述 cli ===> command line interface (命令行接口) // 安装npm install - ...
- ASP.NET报错集合一----.net4.0创建项目后,在iis上部署项目,无法浏览,提示404
前言:这些错误纯属自己在开发项目的时候遇到的问题,比较有针对性.如果有解决不了的问题,请勿喷. 问题描述: .net4.0创建项目后,在iis上部署项目,无法浏览,提示404 搭建项目的环境: 项目是 ...
- vue 图形化设计工具_Vue: Vue-CLI3.0 创建项目
真实的开始需要的:开发服务器: 需要http/https协议访问 BaBel: es6转es5,兼容2015年6月之前的浏览器 postcss less sass: 开发高效 esLint: 协作开发 ...
- 基于vue2.0+ 抽奖项目
前言 临近年关抽奖活动,基于vue2.0+开发的抽奖项目. 便于查看效果,贴上相关地址: 在线示例地址:快速访问 github地址:查看源码 简介 基于vue.js抽奖项目,截屏保存每次抽奖图片至本地 ...
- vue2.0实战项目——简单的快餐店系统
最近学习vue看到网上很多学习的资料,就找了一个项目系统练习,主要是想学习了的一些知识点,系统的组合运用一遍.网上根据技术胖老师博客的内容自己也实战了一遍,挺实用的,对vue框架有了更深入的了解以及自 ...
- 【vue2.0后台项目之登陆】01登陆开发流程分析
登陆开发流程 1.前言 2.vue-admin-template模板介绍 3. vue-admin-template模板结构分析 4.axios的二次封装 5.请求后端接口 6.表单验证 7.派发ac ...
- vue-cli2.0创建项目步骤
Vue是近两年来比较火的一个前端框架(渐进式框架吧),与reactjs和angularjs三国鼎立,我不是职业前端,做过Vue,了解了一下React,听说过Angluar.我只能这么说,我来晚了,没经 ...
- webstrom 运行 vue项目_vue3.0创建项目及API讲解(一)
一.项目创建 1.检查vue-cli脚手架版本(vue -V),低版本的要更新(npm install @vue/cli -g ) 2.创建项目(vue create vue3test ) 选择def ...
最新文章
- 图书抄袭何时休,技术人的版权在哪里?
- NSArray排序问题
- golang中的goredis
- [jQuery]10 Things I Learned from the jQuery Source
- Mvc 自带分页控件PagedList.Mvc Demo示例
- Java Radom类的使用方法实例
- 转jmeter --JDBC请求
- jquery网页刷新后控件失效_jquery动态增减控件如何才能不刷新页面
- 反序列化对象列表发生异常_通过反序列化漏洞,黑客能做什么呢?
- github代码_GitHub代码空间如何提高生产力和降低障碍
- 环境准备 Ubuntu Docker
- 4 合并grid列_Grid教程
- python模块导入与使用
- Sberbank Russian Housing Market比赛总结
- settings.xml
- Python爬虫实战-小说网站爬虫开发
- h2o java_java – 在h2o中加载大于内存大小的数据
- 2019年高考数学解题技巧如何分配时间最合理
- SAP 小币种金额的转换函数和处理
- 表白必备 小心心 biubiubiu~