Skip to content

title: 项目结构

项目结构

移动端工程目录(vue-uniapp-template/src)核心结构如下:

text
src/
  api/           # 接口封装
  components/    # 组件(基础/业务)
  composables/   # 组合式函数
  constants/     # 常量
  enums/         # 枚举
  layouts/       # 布局/容器
  pages/         # 页面
  router/        # 路由封装(如有)
  store/         # Pinia
  styles/        # 全局样式
  types/         # 类型
  utils/         # 工具
  main.ts        # 入口
  App.vue        # 根组件

你最常追代码的几个入口:

  • src/utils/request.ts:请求封装与 token 注入
  • src/utils/auth.ts:登录态判断、回跳
  • src/router/index.ts:路由守卫(meta.requireAuth

页面与 TabBar

TabBar 配置在 pages.config.ts,默认包含:

  • pages/index/index
  • pages/work/index
  • pages/mine/index

基于 MIT 许可发布