proxy-app-global

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Proxy2.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

  1. 项目结构: 遵循 sheep 框架分层架构(详见 references/project-structure.md
  2. 代码组织: 页面、组件、API、Store 按业务模块划分(详见 references/coding-patterns.md
  3. 命名约定: 组件前缀 s-/su-、文件命名 kebab-case(详见 references/naming-conventions.md
  4. 多端适配: 条件编译、平台能力封装(详见 references/multi-platform.md
  1. Project Structure: Follow the sheep framework layered architecture (see references/project-structure.md for details)
  2. Code Organization: Pages, components, APIs, and Stores are divided by business modules (see references/coding-patterns.md for details)
  3. Naming Conventions: Component prefix s-/su-, file naming uses kebab-case (see references/naming-conventions.md for details)
  4. Multi-end Adaptation: Conditional compilation, platform capability encapsulation (see references/multi-platform.md for details)

快速导航

Quick Navigation

新建页面

Create a New Page

  1. pages/
    下创建目录和
    .vue
    文件
  2. pages.json
    中注册路由
  3. 详见 references/coding-patterns.md#页面开发
  1. Create a directory and
    .vue
    file under
    pages/
  2. Register the route in
    pages.json
  3. See references/coding-patterns.md#页面开发 for details

新建 API 接口

Create a New API Interface

  1. sheep/api/
    下按业务模块创建文件
  2. 使用
    request
    封装请求
  3. 详见 references/coding-patterns.md#API接口封装
  1. Create files by business module under
    sheep/api/
  2. Use
    request
    to encapsulate requests
  3. See references/coding-patterns.md#API接口封装 for details

新建 Store 模块

Create a New Store Module

  1. sheep/store/
    下创建 Pinia 模块
  2. 使用
    defineStore
    定义状态
  3. 详见 references/coding-patterns.md#Store状态管理
  1. Create Pinia modules under
    sheep/store/
  2. Use
    defineStore
    to define states
  3. See references/coding-patterns.md#Store状态管理 for details

新建组件

Create a New Component

  1. 业务组件放
    sheep/components/
    (s- 前缀)
  2. UI 组件放
    sheep/ui/
    (su- 前缀)
  3. 详见 references/coding-patterns.md#组件开发
  1. Business components are placed in
    sheep/components/
    (s- prefix)
  2. UI components are placed in
    sheep/ui/
    (su- prefix)
  3. See references/coding-patterns.md#组件开发 for details

关键约束

Key Constraints

  • easycom 自动导入:
    s-*
    su-*
    组件无需手动 import
  • 分包策略: 主包放常用页面,其他按业务分包
  • 请求配置: 统一使用
    sheep/request/index.js
    封装
  • 多端兼容: 使用条件编译处理平台差异
  • easycom auto-import:
    s-*
    and
    su-*
    components do not need to be imported manually
  • 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