1 必须安装 node 和 git (node安装长期维护版)
2 win+r 输入 cmd 回车
3 npm -v (npm是前端的包管理工具)
如果版本号是6以上的版本 需要降级到6
4 npm install -g npm@6.14.15
5 安装cnpm
npm install -g cnpm
6 安装vue脚手架 vue/cli
npm install -g @vue/cli@3.10.0
6 查看vue版本
vue -V (大写的V)
-------------------以上动作为基础安装,每台电脑只做一次即可-----------------------------
1 将目录切入到要创建项目的目录中
2 创建项目
vue create 自己起一个项目名称
3 创建的选项
? Please pick a preset: (Use arrow keys)
default (babel, eslint)
> Manually select features
选择初始要添加的依赖 选择 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
用空格选择
? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) Y
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): (Use arrow keys)
Sass/SCSS (with dart-sass)
Sass/SCSS (with node-sass)
> Less
Stylus
选择Less
? Pick a linter / formatter config:
ESLint with error prevention only
ESLint + Airbnb config
> ESLint + Standard config
ESLint + Prettier
选择 ESLint + Standard config
? 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.? (Use arrow keys)
> In dedicated config files
In package.json
选哪个都可以
? Save this as a preset for future projects? (y/N) N
? Pick the package manager to use when installing dependencies: (Use arrow keys)
Use Yarn
> Use NPM
选择NPM
4 安装依赖
切入项目
cd 项目名称
vue add axios
安装 elementui
vue add element
? How do you want to import Element? (Use arrow keys)
> Fully import
Import on demand
Do you wish to overwrite Element's SCSS variables? (y/N) N
? Choose the locale you want to load (Use arrow keys)
> zh-CN
zh-TW
af-ZA
ar
bg
ca
cs-CZ
(Move up and down to reveal more choices)