vxe-pc-ui

repository·main·Indexed 42 days ago

https://github.com/x-extends/vxe-pc-ui

A comprehensive PC-side component library built on Vue 3, focusing on high performance and concise API design. Version 4.18.14 provides a wide range of components including layout containers, form elements, data display tools, and navigation utilities. It integrates with an ecosystem that includes vxe-table for advanced grids, Vxe Gantt for charts, and vxe-design for visual designers.

Tokens
33.7K
Snippets
186
Records
212
Agent score
50%

What's inside vxe-pc-ui

  1. Overview of vxe-pc-ui components and features

    main

    vxe-pc-ui is a Vue-based component library designed for modern browsers with an efficient, concise API and support for on-demand loading.

    Core Components

    • Layout & Containers: col, row, layout-container (with layout-aside, layout-body, layout-footer, layout-header), spilt (with spilt-pane).
    • Form Elements: form, form-group, form-item, input, number-input, password-input, textarea, select (with optgroup, option), tree-select, checkbox (with checkbox-button, checkbox-group), radio (with radio-button, radio-group), switch, date-picker, date-range-picker, color-picker, upload.
    • Data Display: button, button-group, badge, avatar, card, carousel (with carousel-item), collapse (with collapse-pane), list (virtual list), table-select, tree, icon, image (with image-group, image-preview), result.
    • Navigation & Feedback: menu, tabs (with tab-pane), breadcrumb (with breadcrumb-item), anchor (with anchor-link), pager, steps, drawer, modal, tip, tooltip, alert, loading.
    • Utilities: calendar, countdown, rate, watermark, print, print-page-break, text-ellipsis.
    • Vxe Table: Advanced table components including grid (configuration-based) and table (tag-based).
    • Vxe Gantt: Gantt chart components.
    • Vxe Design: Visual designers for forms (form-design), lists (list-design), and workflows (flow-design).
  2. Install vxe-pc-ui via npm

    main

    You can install the core component library using npm. If you also need the table or design components, you can install them together in a single command.

    npm install vxe-pc-ui
    # Or install the full suite:
    npm install vxe-pc-ui vxe-table vxe-design
    npm install vxe-pc-ui
    # npm install vxe-pc-ui vxe-table vxe-design
  3. Integrate vxe-pc-ui into a Vue application

    main

    To use vxe-pc-ui in a Vue application, import the base component library and its corresponding CSS file. You can then register it as a plugin using .use() during the app creation process.

    Note: The library is designed to work alongside other related packages like vxe-table and vxe-design if needed.

    import { createApp } from 'vue'
    import App from './App.vue'
    import VxeUIBase from 'vxe-pc-ui'
    import 'vxe-pc-ui/lib/style.css'
    
    // Optional related packages:
    // import VxeUITable from 'vxe-table'
    // import 'vxe-table/lib/style.css'
    // import VxeUIDesign from 'vxe-design'
    // import 'vxe-design/lib/style.css'
    
    createApp(App)
      .use(VxeUIBase)
      // .use(VxeUITable)
      // .use(VxeUIDesign)
      .mount('#app')
  4. Use vxe-pc-ui via CDN

    main

    For quick prototyping or environments without a build step, you can use a CDN. Note that it is recommended to lock the version number to avoid breaking changes. You must also include vue and xe-utils as dependencies.

    Note: Using third-party CDNs in production is not recommended as links may become invalid.

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      <!-- style -->
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vxe-pc-ui@4/lib/style.css">
      <!-- vue -->
      <script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
      <!-- vxe dependencies -->
      <script src="https://cdn.jsdelivr.net/npm/xe-utils"></script>
      <script src="https://cdn.jsdelivr.net/npm/vxe-pc-ui@4"></script>
    </head>
    <body>
      <div id="app"></div>
      <script>
        // ... application logic
      </script>
    </body>
    </html>
  5. Integrate vxe-pc-ui into a Vue 3 application

    main

    To use vxe-pc-ui in a Vue 3 project, import the base library and its corresponding CSS file, then register it using .use() in your application entry point.

    If you are using additional packages like vxe-table or vxe-design, import and register them similarly.

    // ...
    import VxeUIBase from 'vxe-pc-ui'
    import 'vxe-pc-ui/lib/style.css'
    
    // import VxeUITable from 'vxe-table'
    // import 'vxe-table/lib/style.css'
    
    // import VxeUIDesign from 'vxe-design'
    // import 'vxe-design/lib/style.css'
    // ...
    
    createApp(App)
      .use(VxeUIBase)
      // .use(VxeUITable)
      // .use(VxeUIDesign)
      .mount('#app')
  6. Run the vxe-pc-ui development project

    main

    If you are working on the vxe-pc-ui source code itself, use the following commands to manage the project:

    1. Install dependencies: npm install
    2. Start local debugging/development server: npm run serve
    3. Compile and package the library: npm run lib. This generates the compiled output in the es and lib directories.
    # Install dependencies
    npm install
    
    # Start local debugging
    npm run serve
    
    # Compile packaging (generates es, lib directories)
    npm run lib
  7. Register vxe-pc-ui in a Vue application

    main

    To use the component library, import the base plugin and its corresponding CSS file, then register it with your Vue application instance using .use().

    import VxeUIBase from 'vxe-pc-ui'
    import 'vxe-pc-ui/lib/style.css'
    
    // If using related packages, you would also import them like this:
    // import VxeUITable from 'vxe-table'
    // import 'vxe-table/lib/style.css'
    // import VxeUIDesign from 'vxe-design'
    // import 'vxe-design/lib/style.css'
    
    createApp(App)
      .use(VxeUIBase)
      // .use(VxeUITable)
      // .use(VxeUIDesign)
      .mount('#app')
  8. Manage dynamic UI components via dynamicStore

    main

    The dynamicStore is a reactive object used to control the visibility and configuration of global UI elements. By modifying the properties of dynamicStore, you can programmatically trigger modals, drawers, loading overlays, watermarks, context menus, and tooltips.

    import { dynamicStore } from 'vxe-pc-ui/dynamics';
    
    // Example: Trigger a global loading state
    dynamicStore.globalLoading = { /* VxeLoadingProps */ };
    
    // Example: Open a modal
    dynamicStore.modals.push({
      /* VxeModalDefines.ModalOptions */
    });
    
    // Example: Clear the loading state
    dynamicStore.globalLoading = null;
  9. Use vxe-pc-ui via global window objects

    main

    In browser-based environments, vxe-pc-ui automatically exposes its exported components and utilities to the global window object. This allows for usage in environments where module imports might not be available or for quick prototyping. The following global variables are available:

    • window.VxeUIAll
    • window.VxeUIBase
    • window.VxeUI
  10. Install and use the VxeDateRangePicker component

    main

    You can integrate the VxeDateRangePicker component into your Vue application using the install method or by registering it directly. The component is exported as VxeDateRangePicker and can also be imported as the default export or via the DateRangePicker alias.

    To register it globally in a Vue app:

    import { createApp } from 'vue'
    import { VxeDateRangePicker } from 'vxe-pc-ui/packages/date-range-picker'
    
    const app = createApp(App)
    app.use(VxeDateRangePicker)
    app.mount('#app')
    import { App } from 'vue'
    import { VxeDateRangePicker } from 'vxe-pc-ui/packages/date-range-picker'
    
    // Global registration
    app.use(VxeDateRangePicker)
  11. Install the VxeFormGroup component

    main

    You can install the VxeFormGroup component into your Vue application using the install method. This registers the component globally within the vxe-pc-ui dynamic app context and the core VxeUI registry.

    To use it in a standard Vue 3 application, call app.use(VxeFormGroup).

    import { createApp } from 'vue'
    import { VxeFormGroup } from 'vxe-pc-ui'
    
    const app = createApp(App)
    app.use(VxeFormGroup)
    app.mount('#app')
  12. Install and register the VxeTableTransfer component

    main

    You can integrate the VxeTableTransfer component into your Vue application using the standard Vue plugin installation pattern. This registers the component globally within your application instance and the vxe-ui ecosystem.

    Depending on your setup, you can use the install method on your Vue app instance or use the exported VxeTableTransfer object directly.

    import { createApp } from 'vue'
    import { VxeTableTransfer } from 'vxe-pc-ui'
    
    const app = createApp({})...
    
    // Register globally via the install method
    app.use(VxeTableTransfer)