线上项目演示地址
- 前台展示网址:http://edufront.lagou.com/#/
- 后台管理系统网址:http://eduboss.lagou.com/#/login
Vs Code 插件
- Vetur: 支持 .vue 文件语法高量
项目准备
Vue CLI 创建项目
创建项目
vue create edu-boss-fed
选择预设
Vue CLI v4.5.9? Please pick a preset:Default ([Vue 2] babel, eslint)Default (Vue 3 Preview) ([Vue 3] babel, eslint)> Manually select features
选择项目中需要的插件
Vue CLI v4.5.9? Please pick a preset: Manually select features? Check the features needed for your project:( ) Choose Vue version(*) Babel( ) TypeScript( ) Progressive Web App (PWA) Support(*) Router(*) Vuex(*) CSS Pre-processors>(*) Linter / Formatter( ) Unit Testing( ) E2E Testing
是否使用 Vue Router 的 history 模式
Vue CLI v4.5.9? Please pick a preset: Manually select features? Check the features needed for your project: Babel, Router, Vuex, CSS Pre-processors, Linter? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) n
选择 CSS 预处理器
? 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)LessStylus
选择代码格式校验与风格
? Pick a linter / formatter config:ESLint with error prevention onlyESLint + Airbnb config> ESLint + Standard configESLint + Prettier
选择何时进行 lint 校验
? Pick additional lint features:(*) Lint on save>(*) Lint and fix on commit
选择配置信息存储位置
? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)> In dedicated config filesIn package.json
是否存储当前预设
? Save this as a preset for future projects? (y/N) n
项目创建完毕 ```powershell � Initializing git repository… ⚙️ Installing CLI plugins. This might take a while… … ⚓ Running completion hooks…
� Generating README.md…
� Successfully created project edu-boss-fed. � Get started with the following commands:
$ cd edu-boss-fed $ npm run serve
11. 进入项目并启动```powershell# 进入项目目录cd edu-boss-fed# 启动预览服务器npm run serve
本地访问
DONE Compiled successfully in 3517msApp running at:- Local: http://localhost:8080/- Network: http://10.78.1.242:8080/Note that the development build is not optimized.To create a production build, run npm run build.
目录结构说明
.├── node_modules 第三方包存储目录├── public 静态资源目录,内部的静态资源都会被简单的复制,⽽不经过 webpack│ ├── favicon.ico│ └── index.html├── src│ ├── assets 资源目录,存储图片等资源│ │ └── logo.png│ ├── components 组件目录│ │ └── HelloWorld.vue│ ├── router 路由模块目录│ │ └── index.js│ ├── store 容器模块目录(Vuex)│ │ └── index.js│ ├── views 路由页面组件目录│ │ ├── About.vue│ │ └── Home.vue│ ├── App.vue 根组件,最终被渲染到 index.html 中的 #app│ └── main.js 入口文件├── .browserslistrc 指定项目的目标浏览器范围,会被 @babel/preset-env 和 Autoprefixer 用来确定要转移的 JS 特性与 CSS 前缀├── .editorconfig 编辑器配置文件,用来维护跨编辑器(或 IDE)的统一代码风格├── .eslintrc.js ESLint 配置文件├── .gitignore Git 的忽略配置文件├── README.md 说明文档├── babel.config.js Babel 配置文件├── package-lock.json 记录包安装时的版本号└── package.json 第三方包的说明文件,记录包的依赖信息等内容
