全局安装 vue-cli:
npm install -g @vue/cli
查看 vue-cli 版本:
vue -V
升级 vue-cli 版本:
npm update -g @vue/cli
使用指定版本的 vue-cli,先删除之前版本再重新安装:
npm uninstall -g @vue/cli
npm install -g @vue/cli@3.4.1
创建项目:
vue create vue-admin项目名
> Manually select features 手动选择配置
(*) Babel
( ) TypeScript
( ) Progressive Web App (PWA) Support
(*) Router
(*) Vuex
(*) CSS Pre-processors
(*) Linter / Formatter
( ) Unit Testing
( ) E2E Testing
? Choose a version of Vue.js that you want to start the project with (Use arrow keys)
> 3.x
Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) n 不使用 history 模式路由
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default):
> Sass/SCSS (with dart-sass)
? Pick a linter / formatter config:
ESLint with error prevention only
ESLint + Airbnb config
> ESLint + Standard config
ESLint + Prettier
? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to
proceed)
(*) Lint on save
(*) Lint and fix on commit 保存和提交时都 lint
? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
> In dedicated config files 单独配置文件
? Save this as a preset for future projects? (y/N) N
启动项目:
cd vue-admin项目名
npm run serve