先初始化一个vue2.0项目
1、安装vue-cli:
npm install -g @vue/cli
可以输入vue -V查看版本
vue -V
现在安装下来的话是@vue/cli 4.3.1版本
2、初始化 vue 项目:
vue create 你的项目名称
确认后:我们选择Manually select feature手动
Please pick a preset:
default (babel, eslint) //自动
❯ Manually select features //手动
随后勾选我们开发常用的:Router、Vuex、CSS Pre-processors 和 Linter / Formatter,
Vue CLI v4.3.1
? Please pick a preset: Manually select features
? 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
然后是否使用history router:选择Y就好
? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) Y
css预处理器:我常选择Less
Sass/SCSS (with dart-sass)
> Sass/SCSS (with node-sass)
Less
Stylus
ESLint:一个插件化的javascript代码检测工具,ESLint + Prettier //使用较多
ESLint with error prevention only
ESLint + Airbnb config
ESLint + Standard config
> ESLint + Prettier
何时检测:
>(*) Lint on save
( ) Lint and fix on commit
如何存放配置 :
In dedicated config files
> In package.json
是否保存本次配置:Y
? Save this as a preset for future projects? (y/N)
然后运行即可
npm run serve