Arco Design Pro for Vue

repository·main·Indexed 23 days ago

https://github.com/arco-design/arco-design-pro-vue

An out-of-the-box enterprise-level application solution built with Vue 3, Pinia, and TypeScript. It leverages the Arco Design Vue component library and provides 16+ page templates, flexible theming via DesignLab, a dark theme switch, Mock API simulation, and I18n multi-language support. The package includes a comprehensive set of API utilities for user authentication, profile management, data visualization, and a v-permission directive for role-based access control.

Tokens
4.5K
Snippets
14
Records
43
Agent score
83%

What's inside arco-design-pro-vue

  1. Overview of Arco Design Pro features

    main

    Arco Design Pro is an enterprise-level application solution built on top of the Arco Design Vue component library. Key features include:

    • Core Stack: Built with TypeScript, Vue3, and Pinia.
    • Templates: Includes 16+ page templates for common scenarios like tables, lists, forms, dashboards, and data visualization.
    • Theming: Supports flexible configuration of page colors and layouts, integration with the DesignLab theme market, and a one-click Dark Theme switch.
    • Development Tools: Features a built-in Mock API simulation scheme and an I18n multi-language solution.
  2. Initialize a new Arco Design Pro project

    main

    To start a new project using Arco Design Pro, you must first install the arco-cli and pnpm globally, then use the arco init command to scaffold your project.

    Follow these steps:

    1. Install the required CLI tools globally via npm.
    2. Run the initialization command with your desired project name.
    $ npm i arco-cli@latest pnpm -g
    
    $ arco init my-project
  3. Define application routes using appRoutes and appExternalRoutes

    main

    The application's routing structure is composed of two main exported arrays of RouteRecordNormalized objects. These are automatically aggregated from module files located in specific directories:

    1. appRoutes: Contains the core application routes. These are loaded from TypeScript files located in the ./modules/ directory.
    2. appExternalRoutes: Contains external or plugin-based routes. These are loaded from TypeScript files located in the ./externalModules/ directory.

    To add new routes to the application, create a new .ts file within either the src/router/routes/modules/ or src/router/routes/externalModules/ directory. The file should export either a single route object or an array of route objects as the default export.

  4. Use the User Authentication API

    main

    The user.ts module provides standard authentication endpoints for managing user sessions and retrieving user-specific data. These functions use axios to communicate with the backend.

    • login(data): Authenticates a user with a username and password. Returns a LoginRes containing a token.
    • logout(): Terminates the current user session.
    • getUserInfo(): Retrieves the current user's state/profile information (returns UserState).
    • getMenuList(): Fetches the dynamic menu routes for the current user (returns RouteRecordNormalized[]).