| 123456789101112131415161718192021222324252627282930313233 |
- # Customization Rules
- These rules are used to guide AI agents and developers to ensure code quality and consistency in this project.
- ## 1. Pinia Persistence
- - **Plugin**: Use `pinia-plugin-persistedstate`.
- - **Syntax**: Use the `persist` option with `paths` array.
- - **Avoid**: Do NOT use `strategies` (deprecated/wrong plugin syntax).
- ```typescript
- // Correct
- persist: {
- paths: ['key1', 'key2']
- }
- ```
- ## 2. TypeScript & Type Safety
- - **Strict Types**: Avoid `any` type whenever possible.
- - **Interfaces**: Define interfaces in `src/types/` for entities used across multiple files.
- - Example: `Product`, `Order`.
- - **Props**: Use `PropType<T>` for complex Vue component props.
- ## 3. Internationalization (i18n)
- - **Strict usage**: Do NOT use hardcoded strings in templates or scripts.
- - **Function**: Always use `t('key')` or `$t('key')`.
- - **Locale Files**: Ensure keys exist in `zh-Hans.json`, `en.json`, `ja.json`, and `zh-Hant.json`.
- ## 4. Vue 3 Composition API
- - **Setup**: Use `<script setup lang="ts">`.
- - **Vant UI**: Use Vant UI 4.x components.
- ## 5. Mock Data
- - **Labeling**: Clearly mark mock data comments with `// Mock`.
- - **Separation**: Keep mock generation logic isolated or easily replaceable.
|