qidao123.com技术社区-IT企服评测·应用市场

标题: 黑马智数Day1 [打印本页]

作者: 光之使者    时间: 2024-9-22 05:31
标题: 黑马智数Day1


src文件夹

src 目次指的是源代码目次,存放项目应用的源代码,包罗项目的逻辑和功能实现,实际上线之后在欣赏器中跑的代码就是它们

包文件 - package.json

可执行下令



项目依赖

开辟和生产都必要:

仅在开辟时必要:


应用入口 - main.js



组件树 - App.vue



路由文件 - vueRouter

只有一级路由的设置写法

  1.   {
  2.     path: '/workbench',
  3.     component: Layout,
  4.     children: [{
  5.       path: '', // 地址为空
  6.       name: 'workbench',
  7.       component: () => import('@/views/workbench/index'),
  8.       meta: { title: '工作台', icon: 'el-icon-eleme' }
  9.     }]
  10.   }
复制代码
同时拥有一级和二级路由的设置写法

  1. {
  2.     path: '/park',
  3.     component: Layout,
  4.     name: 'park',
  5.     meta: { title: '园区管理', icon: 'el-icon-office-building' },
  6.     children: [{
  7.       path: 'building',
  8.       name: 'building',
  9.       meta: { title: '楼宇管理' },
  10.       component: () => import('@/views/Park/Building/index')
  11.     },
  12.     {
  13.       path: 'enterprise',
  14.       name: 'enterprise',
  15.       meta: { title: '企业管理' },
  16.       component: () => import('@/views/Park/Enterprise/index')
  17.     }]
  18.   }
复制代码

状态管理 - Vuex




请求模块说明

request.js模块说明


  1. import axios from 'axios'
  2. const service = axios.create({
  3.   baseURL: 'https://api-hmzs.itheima.net/v1',
  4.   timeout: 5000 // request timeout
  5. })
  6. // 请求拦截器
  7. service.interceptors.request.use(
  8.   config => {
  9.     return config
  10.   },
  11.   error => {
  12.     return Promise.reject(error)
  13.   }
  14. )
  15. // 响应拦截器
  16. service.interceptors.response.use(
  17.   response => {
  18.     return response.data
  19.   },
  20.   error => {
  21.     return Promise.reject(error)
  22.   }
  23. )
  24. export default service
复制代码


apis模块说明


 基础封装逻辑:
  1. import request from '@/utils/request'
  2. // 登录函数
  3. /**
  4. * @description: 登录函数
  5. * @param {*} data { mobile,password}
  6. * @return {*} promise
  7. */
  8. export function login({ mobile, password }) {
  9.   return request({
  10.     url: '/sys/login',  // baseURL + url
  11.     method: 'POST',
  12.     data: {
  13.       mobile,
  14.       password
  15.     }
  16.   })
  17. }
复制代码


路由和菜单的关系

路由表是菜单的数据支持


路由对象的属性和菜单表现对应




使用Git管理项目




免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 qidao123.com技术社区-IT企服评测·应用市场 (https://dis.qidao123.com/) Powered by Discuz! X3.4