proxy-app-global
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseProxy2.0 移动端全局编码规范
Proxy 2.0 Mobile Global Coding Specification
适用于 proxy2.0-app 项目(uni-app + Vue 3 + Vite + Pinia)。
Applicable to the proxy2.0-app project (uni-app + Vue 3 + Vite + Pinia).
项目技术栈
Project Tech Stack
- 框架: uni-app、Vue 3、Vite
- 状态管理: Pinia + pinia-plugin-persist-uni
- 网络请求: luch-request
- 工具库: dayjs、lodash、vue-i18n
- 多端支持: H5、微信小程序、App(Android/iOS)
- Framework: uni-app、Vue 3、Vite
- State Management: Pinia + pinia-plugin-persist-uni
- Network Request: luch-request
- Tool Library: dayjs、lodash、vue-i18n
- Multi-end Support: H5, WeChat Mini Program, App (Android/iOS)
项目根路径
Project Root Path
所有路径基于 proxy2.0-app/ 根目录,源码位于 proxy2.0-app/src/。
All paths are based on the proxy2.0-app/ root directory, and the source code is located in proxy2.0-app/src/.
核心规范概览
Core Specification Overview
- 项目结构: 遵循 sheep 框架分层架构(详见 references/project-structure.md)
- 代码组织: 页面、组件、API、Store 按业务模块划分(详见 references/coding-patterns.md)
- 命名约定: 组件前缀 s-/su-、文件命名 kebab-case(详见 references/naming-conventions.md)
- 多端适配: 条件编译、平台能力封装(详见 references/multi-platform.md)
- Project Structure: Follow the sheep framework layered architecture (see references/project-structure.md for details)
- Code Organization: Pages, components, APIs, and Stores are divided by business modules (see references/coding-patterns.md for details)
- Naming Conventions: Component prefix s-/su-, file naming uses kebab-case (see references/naming-conventions.md for details)
- Multi-end Adaptation: Conditional compilation, platform capability encapsulation (see references/multi-platform.md for details)
快速导航
Quick Navigation
新建页面
Create a New Page
- 在 下创建目录和
pages/文件.vue - 在 中注册路由
pages.json - 详见 references/coding-patterns.md#页面开发
- Create a directory and file under
.vuepages/ - Register the route in
pages.json - See references/coding-patterns.md#页面开发 for details
新建 API 接口
Create a New API Interface
- 在 下按业务模块创建文件
sheep/api/ - 使用 封装请求
request - 详见 references/coding-patterns.md#API接口封装
- Create files by business module under
sheep/api/ - Use to encapsulate requests
request - See references/coding-patterns.md#API接口封装 for details
新建 Store 模块
Create a New Store Module
- 在 下创建 Pinia 模块
sheep/store/ - 使用 定义状态
defineStore - 详见 references/coding-patterns.md#Store状态管理
- Create Pinia modules under
sheep/store/ - Use to define states
defineStore - See references/coding-patterns.md#Store状态管理 for details
新建组件
Create a New Component
- 业务组件放 (s- 前缀)
sheep/components/ - UI 组件放 (su- 前缀)
sheep/ui/ - 详见 references/coding-patterns.md#组件开发
- Business components are placed in (s- prefix)
sheep/components/ - UI components are placed in (su- prefix)
sheep/ui/ - See references/coding-patterns.md#组件开发 for details
关键约束
Key Constraints
- easycom 自动导入: 和
s-*组件无需手动 importsu-* - 分包策略: 主包放常用页面,其他按业务分包
- 请求配置: 统一使用 封装
sheep/request/index.js - 多端兼容: 使用条件编译处理平台差异
- easycom auto-import: and
s-*components do not need to be imported manuallysu-* - Subpackage Strategy: Common pages are placed in the main package, and others are subpackaged by business
- Request Configuration: Uniformly use the encapsulation in
sheep/request/index.js - Multi-end Compatibility: Use conditional compilation to handle platform differences
详细规范文档
Detailed Specification Documents
- 项目结构详解 - 目录组织、文件职责
- 编码模式 - 页面、API、Store、组件开发模式
- 命名规范 - 文件、变量、组件命名约定
- 多端适配 - 条件编译、平台能力使用
- Detailed Project Structure - Directory organization, file responsibilities
- Coding Patterns - Development patterns for pages, APIs, Stores, components
- Naming Conventions - Naming conventions for files, variables, components
- Multi-end Adaptation - Conditional compilation, platform capability usage