vue-cli搭建项目

2020-08-15  本文已影响0人  青乌
//查看版本
vue -V

2.0版本步骤

vue init webpack  <project name> //构建项目
npm install  //安装依赖
npm run dev  //启动
npm run build  //打包

3.0以及4.0版本步骤

vue create <project name>  //构建项目
npm run serve //启动
npm run build  //打包

卸载旧版本

npm uninstall vue-cli -g //卸载旧版本
npm install -g @vue/cli  //安装新版本

配置

上下箭头移动,enter选定下一步,space多选选中,a全选,i反选。

1.选择手动配置

default(babel,eslint)//默认
Manually select features  //手动

2.根据需要选择:一般是Babel 、Router、Vuex、CSS Pre-processors 、Linter / Formatter

Babel //转码器,可以将ES6代码转为ES5代码,从而在现有环境执行。 
TypeScript// TypeScript是一个JavaScript(后缀.js)的超集(后缀.ts)包含并扩展了 JavaScript 的语法,需要被编译输出为 JavaScript在浏览器运行,目前较少人再用
Progressive Web App (PWA) Support// 渐进式Web应用程序
Router // vue-router(vue路由)
Vuex // vuex(vue的状态管理模式)
CSS Pre-processors // CSS 预处理器(如:less、sass)
Linter / Formatter // 代码风格检查和格式化(如:ESlint)
Unit Testing // 单元测试(unit tests)
E2E Testing // e2e(end to end) 测试

3.是否使用history router

4.选择css 预处理器(用啥选啥)

Sass/Scss(with dart-sass) //官方推荐,保存编译
Sass/Scss(with node-sass) //实时自动编译
Less
Stylus

5.选择Eslint代码验证规则(ESLint + Prettier //使用较多)

ESLint with error prevention only
ESLint + Airbnb config
ESLint + Standard config
ESLint + Prettier

6.验证时间(选择保存监测)

Lint on save // 保存就检测
Lint and fix on commit // fix和commit时候检查

7.选择如何存放配置(选择独立文件)

In dedicated config files // 独立文件放置
In package.json // 放package.json里

8.是否保存当前配置
y然后输入名字

y/n //是否保存
上一篇下一篇

猜你喜欢

热点阅读