How pure-admin/vue-pure-admin works
Below are specific guidelines and instructions tailored to this project:
Main Components and Layers
• Entry Point & Bootstrapping: Represent the root of the application (index.html and src/main.ts) that initializes the SPA.
• UI Layer – Layouts and Views:
• Layout Component: (src/layout) which encapsulates the common frames, navbar, sidebar, footer, etc.
• Views: (src/views) include pages for system management (system, table, editor, nested, chatai, etc.) where each subfolder represents a different module/page.
• Components: (src/components) with granular UI components (e.g., ReAuth, ReBarcode, ReDialog, etc.) shared across views.
• Routing: (src/router) showcasing the use of a dynamic route structure with modular files for different functionalities.
• State Management: (src/store) handled via Pinia modules that manage global states such as user, app settings, permissions, etc.
• API Services: (src/api) which comprises various modules (list, system, user, mock, etc.) that handle data fetching and API calls.
• Plugins & Utilities:
• Plugins: (src/plugins) for integrating Element Plus, ECharts, internationalization (i18n), and vxeTable.
• Directives: (src/directives) which implement custom behaviors (auth, copy, longpress, ripple, etc.) across the UI.
• Utils: (src/utils) containing helper functions for authentication, HTTP requests, message handling, and more.
• Assets & Internationalization:
• Locales: (locales/) include internationalized text (English, Chinese, etc.).
• Build & Deployment: Tools like Dockerfile, build scripts (build/ folder for compressing, optimizing, etc.), and configuration files for ESLint, Prettier, Tailwind, etc.
Relationships and Interactions
• The entry point “index.html” loads the bundled SPA initialized from “src/main.ts”, which in sequence loads global configurations, plugins, routes, and state.
• UI components (from both src/views and src/components) interact with the state management layer (Pinia) to drive dynamic data.
• The router is in charge of mapping URL paths to views across the admin system.
• API modules provide data to the views either directly or via actions in the store.
• Custom directives and utilities hook into UI components to add behaviors, while plugins extend functionality for third-party libraries (eg., Element-Plus for UI components, ECharts for dashboards).
Architectural Patterns
• Component-Based Architecture: The many reusable components, laid out inside src/components.
• Separation of Concerns: Clear division among UI (views/layouts), business logic (store, API services), and configuration (plugins, utilities, directives).
• Modularization: The router and store are divided into module-specific files (e.g., src/router/modules and src/store/modules) making it easier to extend and maintain.
• Extensibility: With many standalone components and a plugin system, it is straightforward to add new features or modify existing functionality.
Relevant Technologies and Frameworks
• Vue3, Vite (for build and hot reload)
• Element-Plus (UI components)
• Pinia (state management)
• TypeScript (static typing throughout the project)
• Tailwindcss (styling and responsive design)
• Docker (for containerized deployment)
• ESLint, Prettier, and Commitlint (for code quality and consistency)
Recommended Elements
• Use clear labels for each component (e.g., “Entry Point”, “Router”, “State Management”, “Layouts”, “Shared Components”).
• From the entry point to plugins, router, and store.
• Between router and views to show navigation.
• From views/components to API services and state management.
• For utility modules (directives, plugins) interacting with the UI components.