Initial commit: G3FO recurring investment schedule frontend
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
---
|
||||
description: schedule-invest-plan 技术栈与全局约定(URL 语言/主题、文档)
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# 项目核心约定
|
||||
|
||||
- 栈:Vue 3 + TypeScript + Vite、Vue Router、Pinia、Axios、vue-i18n、Sass、ECharts、Element Plus(按需自动导入)。
|
||||
- 代码修改须同步维护 `IMPACT_ANALYSIS.md`、`TASK_SUMMARY.md`(团队规范)。
|
||||
|
||||
## 语言与主题(仅 URL)
|
||||
|
||||
- 查询参数:`lang`(或 `locale`)、`theme`;**禁止**用 `localStorage` 持久化语言/主题。
|
||||
- 缺省:`lang=zh-TW`、`theme=dark`;`theme` 支持别名 `light`/`day`、`dark`/`night`。
|
||||
- 解析与写入:`src/config/urlPreferences.ts`;切换语言/主题用 `useUrlPreferences()`(更新 `router.replace` 的 query)。
|
||||
- 路由跳转保留 query:`useRouteWithPreferences().linkTo(path)` 或等价 `{ path, query: route.query }`。
|
||||
- i18n:`src/i18n/`(简/繁/英);Element Plus 语言:`getElementPlusLocale` + 根节点 `el-config-provider`。
|
||||
- 深色:`applyTheme` 设置 `data-theme` 与 `html.dark`(Element Plus 深色变量)。
|
||||
|
||||
## 详细规范文档
|
||||
|
||||
- 响应式:`docs/RESPONSIVE_SPEC.md`(断点、布局、禁止事项以该文档为准)。
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
description: PC/移动端响应式与布局(Mobile First)
|
||||
globs: src/**/*.{vue,scss}
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# 响应式与布局
|
||||
|
||||
完整条文见 `docs/RESPONSIVE_SPEC.md`。实现时必须遵守:
|
||||
|
||||
## 断点(勿私自改数值)
|
||||
|
||||
| 令牌 | 宽度 |
|
||||
|------|------|
|
||||
| sm | 576px |
|
||||
| md | 768px |
|
||||
| lg | 1024px |
|
||||
| xl | 1280px |
|
||||
|
||||
- TS 真相:`src/constants/breakpoints.ts`;SCSS:`src/styles/breakpoints.scss`(两处数值一致)。
|
||||
|
||||
## 样式
|
||||
|
||||
- **移动优先**:默认小屏样式,用 `@include respond-up(md|lg)` 增强。
|
||||
- **禁止**业务里手写零散 `@media (max-width: 750px)`;Vite 已全局注入 `respond-up/down/between`。
|
||||
- 颜色/背景用 `var(--color-*)`;页面边距用 `var(--page-padding-x/y)`,勿写死 `padding: 32px`。
|
||||
- 可点击区域最小 **44×44px**。
|
||||
|
||||
## 壳层结构
|
||||
|
||||
```
|
||||
.app-shell > .app-container > AppHeader + 页面
|
||||
```
|
||||
|
||||
- 路由视图根节点包 **`AppPage`**(`src/components/layout/AppPage.vue`)。
|
||||
- 内容最大宽度 `--layout-max-width`(1280px)。
|
||||
|
||||
## 脚本
|
||||
|
||||
```ts
|
||||
import { useBreakpoint } from '@/composables/useBreakpoint'
|
||||
const { isMobile, isDesktop } = useBreakpoint()
|
||||
```
|
||||
|
||||
- 仅用于布局/组件属性(如表单 `label-position`);勿用 `width` 驱动业务逻辑。
|
||||
- 勿在页面重复 `window.addEventListener('resize')`(图表等组件内除外)。
|
||||
|
||||
## Element Plus
|
||||
|
||||
- 栅格默认 `xs="24"`,再 `sm`/`lg` 分列;`gutter` 移动 12、PC 20 为宜。
|
||||
- 移动:`label-position="top"`;表格移动优先卡片或 `.app-table-scroll` 横滚。
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
description: Vue 单文件组件与本仓库写法
|
||||
globs: src/**/*.vue
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Vue SFC 约定
|
||||
|
||||
## 结构
|
||||
|
||||
- 路由页:`views/*` 根节点使用 `<AppPage>`;标题/导语可用 `.app-page__title`、`.app-page__lead`。
|
||||
- 样式:`<style scoped lang="scss">`;需要断点时用 `respond-up` / `respond-down` mixin。
|
||||
- 路径别名:`@/` → `src/`。
|
||||
|
||||
## 导航与 URL 参数
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { useRouteWithPreferences } from '@/composables/useRouteWithPreferences'
|
||||
const { linkTo } = useRouteWithPreferences()
|
||||
</script>
|
||||
<RouterLink :to="linkTo('/')">...</RouterLink>
|
||||
```
|
||||
|
||||
## 表单示例(响应式)
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { useBreakpoint } from '@/composables/useBreakpoint'
|
||||
const { isMobile } = useBreakpoint()
|
||||
</script>
|
||||
<el-form :label-position="isMobile ? 'top' : 'right'">
|
||||
```
|
||||
|
||||
## 禁止
|
||||
|
||||
- 不要复制 PC/H5 两套页面文件。
|
||||
- 不要绕过 URL 直接改 `i18n.global.locale` 或 `applyTheme`(应走 store + query 同步链路)。
|
||||
Reference in New Issue
Block a user