前置基础
- vue
- axios
- element-ui
- npm
- vscode
初始化项目
1.创建vue2工程
1.1
vue create projectName
1.2 选择
1.3 初始化 vue-cli 的核心步骤:
- 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)
+ 2.x
+ 3.x - Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n)
+ n - 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 - Pick a linter / formatter config: (Use arrow keys)
+ ESLint + Airbnb config
+ ESLint + Standard config
+ ESLint + Prettier - Pick additional lint features: (Press to select, to toggle all, to invert selection)
+ (*) Lint on save
+ ( ) Lint and fix on commit - Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
+ In dedicated config files
+ In package.json - Save this as a preset for future projects? (y/N)
+ N
1.4 梳理项目结构
为项目开发做准备,把不需要的代码、文件删除掉
1. 重置 src/App.vue
组件中的代码
<template>
<div>App 根组件</div>
</template>