43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
---
|
|
description: 项目通用规范,涵盖技术栈、目录结构、编码约定
|
|
alwaysApply: true
|
|
---
|
|
|
|
# 项目约定
|
|
|
|
## 技术栈
|
|
|
|
- **框架**: Vue 2 + Vue CLI 4
|
|
- **路由**: Vue Router 3 (history 模式)
|
|
- **状态管理**: Vuex 3
|
|
- **语言**: JavaScript (无 TypeScript)
|
|
- **UI 库**: Element UI + Vant 2
|
|
- **样式**: SCSS + scoped + PostCSS px2rem (rootValue: 37.5)
|
|
- **移动端适配**: lib-flexible + postcss-plugin-px2rem
|
|
- **HTTP**: Axios
|
|
|
|
## 目录结构
|
|
|
|
```
|
|
src/
|
|
├── api/ # API 请求模块
|
|
├── assets/ # 静态资源 (图片、样式)
|
|
├── plugins/ # 插件 (Element UI、flexible 等)
|
|
├── router/ # 路由配置
|
|
├── store/ # Vuex store
|
|
├── utils/ # 工具函数
|
|
├── views/ # 页面视图
|
|
│ └── land/ # 落地页
|
|
│ ├── index.vue # 主入口,根据设备/模板切换组件
|
|
│ └── components/ # 落地页子组件 (mobile1, pc2 等)
|
|
```
|
|
|
|
## 编码规范
|
|
|
|
- 使用 ES6+ 语法,Options API 风格
|
|
- 组件通过 props 接收 `os`、`configs`、`switchData` 等父级数据
|
|
- 事件通过 `$emit` 向上传递 (`recordClick`、`getApkInfo`)
|
|
- 图片资源使用相对路径引用,放在 `assets/images/` 对应子目录下
|
|
- px 值会被 PostCSS 自动转为 rem,带 `pcm` 选择器前缀的除外
|
|
- 始终用中文回复
|