### Install View UI Plus with npm
Source: https://github.com/view-design/viewuiplus/blob/master/README.md
Install the View UI Plus library using npm. This is the recommended method for project integration.
```bash
npm install view-ui-plus --save
```
--------------------------------
### Global Plugin Installation Configuration
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/configuration.md
Configure global settings like default component size and transfer behavior when installing the ViewUIPlus plugin.
```javascript
import { createApp } from 'vue'
import App from './App.vue'
import ViewUIPlus from 'view-ui-plus'
import 'view-ui-plus/dist/styles/viewuiplus.css'
const app = createApp(App)
app.use(ViewUIPlus, {
size: 'large', // Default component size
transfer: true, // Transfer (teleport) dropdowns
// Component-specific configurations below
})
app.mount('#app')
```
--------------------------------
### ViewUIPlusInstallOptions Interface
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/types.md
Extends ViewUIPlusGlobalOptions to include additional configuration for plugin installation. Use this when installing ViewUIPlus with `app.use()`, providing locale and i18n settings.
```typescript
interface ViewUIPlusInstallOptions extends ViewUIPlusGlobalOptions {
locale?: any;
i18n?: any;
}
```
--------------------------------
### Table Component Usage Example
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/data-display-components.md
Demonstrates how to use the Table component with data, column definitions, and event handlers. Ensure the 'view-ui-plus' library is imported.
```vue
```
--------------------------------
### Basic ViewUIPlus Setup in Vue.js 3
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/README.md
Set up ViewUIPlus in a Vue.js 3 application. This involves importing the library, its CSS, and registering it as a Vue plugin.
```javascript
import { createApp } from 'vue'
import App from './App.vue'
import ViewUIPlus from 'view-ui-plus'
import 'view-ui-plus/dist/styles/viewuiplus.css'
const app = createApp(App)
app.use(ViewUIPlus)
app.mount('#app')
```
--------------------------------
### Progress Component Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/data-display-components.md
Shows different states and configurations of the Progress component, including success, active, and text inside the bar.
```vue
```
--------------------------------
### TreeSelect Usage Example
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/utility-components.md
Demonstrates the TreeSelect component for selecting items from a hierarchical structure. This example enables multiple selections and search functionality.
```vue
```
--------------------------------
### Select Component Usage Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/form-components.md
Illustrates various ways to use the Select component, including basic single selection, multiple selection, filtering, and remote data fetching.
```APIDOC
## Select Component Usage Examples
### Description
Demonstrates practical implementation of the Select component for different use cases.
### Usage Example
```vue
```
--------------------------------
### ViewUIPlus Global Configuration
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/README.md
Shows how to configure ViewUIPlus globally using app.use(). This example sets the default component size, enables body transfer for dropdowns, and configures modal behavior.
```javascript
app.use(ViewUIPlus, {
size: 'large',
transfer: true,
select: { arrow: 'ios-arrow-down' },
modal: { maskClosable: false },
// ... more configuration options
})
```
--------------------------------
### TimePicker Usage Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/utility-components.md
Shows how to use the TimePicker component for single time selection and time range selection with custom formatting.
```vue
```
--------------------------------
### Badge Component Usage Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/data-display-components.md
Illustrates different ways to use the Badge component, including with a count, as a dot, and showing zero counts.
```vue
StatusItems
```
--------------------------------
### Space Component Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/layout-components.md
Illustrates different ways to use the Space component for horizontal and vertical spacing, including custom sizes and dividers.
```vue
Item 1
Item 2
Item 3
Item 1Item 2Item 3
```
--------------------------------
### View UI Plus Select Component Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/form-components.md
Demonstrates various configurations of the Select component, including single select, multiple select, filterable select, and remote search functionality. Ensure Select and Option components are imported.
```vue
```
--------------------------------
### AutoComplete Usage Example
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/utility-components.md
Demonstrates how to use the AutoComplete component for input suggestions. It filters a list of options based on user input and handles option selection.
```vue
```
--------------------------------
### Complete Style Directive Example
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/directives.md
Demonstrates applying multiple v-style directives to a single element for comprehensive inline styling, including text and background properties.
```vue
Styled content
```
--------------------------------
### Vue Modal and Button Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/README.md
Demonstrates how to use the Button and Modal components in Vue.js. Includes basic setup for opening a modal, capturing user input, and handling confirmation.
```vue
```
--------------------------------
### Split Component for Resizable Panes
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/layout-components.md
Demonstrates the Split component for creating a resizable container with two panes. It includes an example of handling the resize event.
```vue
Left pane content
Right pane content
```
--------------------------------
### Global View UI Plus Configuration
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/configuration.md
This snippet shows the complete setup for View UI Plus, including importing necessary modules, CSS, and configuring global options like size, spacing, transfer settings, and component-specific defaults. It also demonstrates how to set the locale.
```javascript
import { createApp } from 'vue'
import App from './App.vue'
import ViewUIPlus from 'view-ui-plus'
import locale from 'view-ui-plus/dist/locale/en-US'
import 'view-ui-plus/dist/styles/viewuiplus.css'
const app = createApp(App)
app.use(ViewUIPlus, {
// Size and spacing
size: 'default',
space: {
size: 'medium'
},
// Transfer settings
transfer: true,
// Component-specific configurations
select: {
arrow: 'ios-arrow-down',
customArrow: false,
arrowSize: 12
},
menu: {
arrow: 'ios-arrow-down',
customArrow: false,
arrowSize: 12
},
tree: {
arrow: 'ios-arrow-right',
customArrow: false,
arrowSize: 12
},
cascader: {
arrow: 'ios-arrow-down',
customArrow: false,
arrowSize: 12,
itemArrow: 'ios-arrow-right',
customItemArrow: false,
itemArrowSize: 10
},
colorPicker: {
arrow: 'ios-arrow-down',
customArrow: false,
arrowSize: 12
},
datePicker: {
icon: 'ios-calendar',
customIcon: false,
iconSize: 14
},
timePicker: {
icon: 'ios-clock',
customIcon: false,
iconSize: 14
},
tabs: {
closeIcon: 'ios-close',
customCloseIcon: false,
closeIconSize: 14
},
modal: {
maskClosable: false
},
typography: {
copyConfig: {},
editConfig: {},
ellipsisConfig: {}
},
image: {
toolbar: []
},
// Locale
locale: locale
})
app.mount('#app')
```
--------------------------------
### Form Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/form-components.md
Demonstrates the basic setup of a Form component with data binding, validation rules, and submission handling. Use this for creating forms with multiple input fields.
```vue
```
--------------------------------
### DatePicker Usage Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/utility-components.md
Demonstrates various configurations for the DatePicker component, including single date, date range, datetime selection, and disabling specific dates.
```vue
```
--------------------------------
### Flex Layout with Row and Col
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/layout-components.md
Example of using Row with `type="flex"` to create a flexbox layout, demonstrating alignment and justification of columns.
```vue
Left
Center
Right
```
--------------------------------
### Slider Component Examples
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/utility-components.md
Shows various ways to use the Slider component, including single value, range selection, and sliders with stops and custom marks.
```vue
```
--------------------------------
### Global Usage with Script Tag
Source: https://github.com/view-design/viewuiplus/blob/master/README.md
Include View UI Plus globally using script tags and a CSS link. This method is suitable for simpler projects or quick setups.
```html
```
--------------------------------
### Accessing Global Configuration in Setup API
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/configuration.md
Shows how to access the global View UI Plus configuration object within a Vue component using the Composition API's `getCurrentInstance`. This allows you to read global settings like size, transfer, or specific component configurations.
```vue
```
--------------------------------
### CountUp Component
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/miscellaneous-components.md
Provides an animated counter that counts up from a start value to an end value over a specified duration.
```APIDOC
## CountUp Component
Animated number counter.
### Props
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| start-value | `number` | No | `0` | Start number |
| end-value | `number` | Yes | — | End number |
| duration | `number` | No | `2.5` | Animation duration (seconds) |
| decimals | `number` | No | `0` | Decimal places |
| decimal-separator | `string` | No | `'.'` | Decimal separator |
| thousands-separator | `string` | No | `','` | Thousands separator |
| prefix | `string` | No | `''` | Number prefix |
| suffix | `string` | No | `''` | Number suffix |
| use-easing | `boolean` | No | `true` | Use easing animation |
| separator | `string` | No | `','` | Separator character |
### Events
| Event | Parameters | Description |
|-------|-----------|-------------|
| onMounted | — | Component mounted |
### Usage Example
```vue
```
**Source**: `types/count-up.d.ts`
```
--------------------------------
### Carousel Component with Images
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/data-display-components.md
Demonstrates a basic Carousel setup with automatic playback and multiple slides containing images.
```vue
```
--------------------------------
### TypeScript Configuration and Imports
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/README.md
Demonstrates how to import components and global configuration types in a TypeScript environment. Allows for type checking and autocompletion.
```typescript
import { Button } from 'view-ui-plus'
import type { ViewUIPlusGlobalOptions } from 'view-ui-plus'
const config: ViewUIPlusGlobalOptions = {
size: 'large'
}
```
--------------------------------
### Cascader Data Structure Example
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/utility-components.md
Illustrates the expected data structure for the Cascader component, which is an array of objects, each potentially containing nested children.
```javascript
[
{
label: 'Item 1',
value: 'item1',
children: [
{ label: 'Item 1-1', value: 'item1-1' },
{ label: 'Item 1-2', value: 'item1-2' }
]
},
{
label: 'Item 2',
value: 'item2',
children: [
{ label: 'Item 2-1', value: 'item2-1' }
]
}
]
```
--------------------------------
### List Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/data-display-components.md
Demonstrates how to use the List, ListItem, and ListItemMeta components to display a list of items with descriptions.
```vue
{{ item.description }}
```
--------------------------------
### Tooltip Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/feedback-components.md
Demonstrates how to use the Tooltip component with basic and rich HTML content. Imports are required.
```vue
Rich HTML content
In the tooltip
```
--------------------------------
### Ellipsis Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/miscellaneous-components.md
Truncates long text content, allowing expansion and collapse. Supports custom 'more'/'less' text and a tooltip on hover for the second example.
```vue
{{ longText }}
```
--------------------------------
### Basic Modal Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/feedback-components.md
Demonstrates how to open and manage a basic modal component using v-model for visibility control and handling OK/Cancel events.
```vue
Modal content goes here
```
--------------------------------
### Basic Timeline Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/data-display-components.md
Demonstrates how to use the Timeline and TimelineItem components to display a sequence of events with different statuses.
```vue
Event 1 - Completed
Event 2 - In Progress
Event 3 - Error
```
--------------------------------
### Modal Service Methods
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/feedback-components.md
Illustrates how to use the Modal service for confirmation, alerts, and informational dialogs directly via `this.$Modal`.
```javascript
// Confirmation dialog
this.$Modal.confirm({
title: 'Confirm Action',
content: 'Are you sure?',
okText: 'Yes',
cancelText: 'No',
onOk: () => {
console.log('Confirmed')
},
onCancel: () => {
console.log('Cancelled')
}
})
// Alert dialog
this.$Modal.alert({
title: 'Alert',
content: 'Alert message',
onOk: () => {
console.log('Alert closed')
}
})
// Info, Success, Warning, Error dialogs
this.$Modal.info({ title: 'Info', content: 'Info message' })
this.$Modal.success({ title: 'Success', content: 'Success message' })
this.$Modal.warning({ title: 'Warning', content: 'Warning message' })
this.$Modal.error({ title: 'Error', content: 'Error message' })
```
--------------------------------
### Result Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/miscellaneous-components.md
Shows success, error, info, or warning messages with a title and custom content. Features a button in the footer to view orders for the success example.
```vue
Your order has been confirmed
```
--------------------------------
### Cascader Usage Example
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/utility-components.md
Shows how to implement the Cascader component for selecting hierarchical data. It binds to a ref for the selected values and uses a predefined cascade data array.
```vue
```
--------------------------------
### Checkbox Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/form-components.md
Shows examples of using the Checkbox component for single selections with a label and for multiple selections within a CheckboxGroup. It utilizes v-model for state management.
```vue
```
--------------------------------
### Circle Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/miscellaneous-components.md
Renders a circular progress indicator. The first example shows a custom percentage with inner text, while the second demonstrates a dashboard mode with a different color.
```vue
{{ progress }}%
```
--------------------------------
### Exception Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/miscellaneous-components.md
Displays different exception types (e.g., 404, 500) with customizable titles and descriptions. Includes a button to navigate back home for the 404 example.
```vue
```
--------------------------------
### Select Component API
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/form-components.md
API documentation for the Select component, detailing its configurable properties.
```APIDOC
## Select Component API
### Description
Provides a comprehensive set of properties to configure the Select component's behavior and appearance, including selection modes, filtering, remote data handling, and display options.
### Props
* **model-value** (`string | number | array`): Required: No, Default: —. Selected value(s), use v-model for binding.
* **multiple** (`boolean`): Required: No, Default: `false`. Enable multiple selection.
* **disabled** (`boolean`): Required: No, Default: `false`. Disable selection.
* **clearable** (`boolean`): Required: No, Default: `false`. Show clear button (single select only).
* **filterable** (`boolean`): Required: No, Default: `false`. Enable search filtering.
* **filter-by-label** (`boolean`): Required: No, Default: `false`. Filter only by option label.
* **remote-method** (`function`): Required: No, Default: —. Remote search function.
* **loading** (`boolean`): Required: No, Default: `false`. Show loading state (remote search).
* **loading-text** (`string`): Required: No, Default: —. Loading message text.
* **default-label** (`string | number | array`): Required: No, Default: —. Default label for remote search.
* **size** (`'large' | 'small' | 'default'`): Required: No, Default: `'default'`. Select size.
* **placeholder** (`string`): Required: No, Default: —. Placeholder text.
* **not-found-text** (`string`): Required: No, Default: —. Empty options message.
* **label-in-value** (`boolean`): Required: No, Default: `false`. Return object with label and value.
* **placement** (`'bottom' | 'top' | 'top-start' | 'bottom-start' | 'top-end' | 'bottom-end'`): Required: No, Default: `'bottom'`. Dropdown direction.
* **transfer** (`boolean`): Required: No, Default: `false`. Teleport dropdown to body.
* **element-id** (`string`): Required: No, Default: —. HTML id attribute.
* **transfer-class-name** (`string`): Required: No, Default: —. Additional class for transferred dropdown.
* **prefix** (`string`): Required: No, Default: —. Prefix icon.
* **max-tag-count** (`number`): Required: No, Default: —. Max tags to show (multiple mode).
* **max-tag-placeholder** (`string | function`): Required: No, Default: —. Placeholder for hidden tags.
### Slots
* **default**: Option elements
### Events
* **update:modelValue** (`value`): Value change (v-model).
* **onChange** (`value`): Change event.
* **onQuery** (`query`): Search query change.
* **onOpenChange** (`open`): Dropdown open/close state.
```
--------------------------------
### View UI Plus Input Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/form-components.md
Demonstrates various configurations of the Input component, including basic text, password, search, textarea, and inputs with icons. Uses v-model for data binding and event handlers for user interactions.
```vue
```
--------------------------------
### Numeral Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/miscellaneous-components.md
Demonstrates various formatting options for the Numeral component, including thousands separators, currency, and percentages. Ensure the Numeral component is imported.
```vue
```
--------------------------------
### Poptip Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/feedback-components.md
Shows how to use the Poptip component for confirmation dialogs. Requires importing Poptip and Button components.
```vue
```
--------------------------------
### $Spin Service
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/README.md
Provides a loading spinner service with methods to show and hide the spinner.
```APIDOC
## $Spin Service
### Description
Provides a loading spinner service with methods to show and hide the spinner.
### Methods
- show()
- hide()
```
--------------------------------
### CountUp Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/miscellaneous-components.md
Shows how to use the CountUp component for animating number counters. It supports custom start and end values, duration, decimals, and prefixes/suffixes. Import the CountUp component to use it.
```vue
```
--------------------------------
### Flex Layout (Row with type='flex')
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/layout-components.md
Demonstrates how to use the Row component with `type="flex"` to achieve flexbox layouts. It includes examples of justify and align props for controlling element distribution and alignment.
```APIDOC
## Flex Layout (Row with type='flex')
Use Row with `type="flex"` and alignment props for flexbox layout.
### Example
```vue
Left
Center
Right
```
```
--------------------------------
### Notice Service API
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/feedback-components.md
Demonstrates using the Notice service for displaying various types of notifications programmatically. Access via `this.$Notice`.
```javascript
this.$Notice.open({
title: 'Notification Title',
desc: 'Notification description',
duration: 4.5
})
this.$Notice.info({ title: 'Info', desc: 'Info message' })
this.$Notice.success({ title: 'Success', desc: 'Success message' })
this.$Notice.warning({ title: 'Warning', desc: 'Warning message' })
this.$Notice.error({ title: 'Error', desc: 'Error message' })
// Close all notices
this.$Notice.closeAll()
```
--------------------------------
### Configure Image Component Toolbar
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/configuration.md
Set up the toolbar buttons for the Image component's preview mode. Affects available image manipulation options.
```typescript
interface ImageConfig {
toolbar: any[]; // Toolbar button configuration
}
```
```javascript
app.use(ViewUIPlus, {
image: {
toolbar: [
{ name: 'zoom-in', icon: 'ios-add' },
{ name: 'zoom-out', icon: 'ios-remove' },
{ name: 'rotate', icon: 'ios-redo' },
{ name: 'download', icon: 'ios-download' }
]
}
})
```
--------------------------------
### Include ViewUIPlus via CDN
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/installation.md
Include ViewUIPlus using CDN links for JavaScript and CSS. This is useful for quick integration without a build process.
```html
```
--------------------------------
### Row and Col Responsive and Offset Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/layout-components.md
Illustrates responsive column behavior across different screen sizes (md, lg) and demonstrates using offset for positioning.
```vue
Half width
Half width
Responsive column
First
Third (offset by 8)
```
--------------------------------
### Tag Component Usage
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/data-display-components.md
Demonstrates basic and interactive usage of the Tag component, including different styles and event handling.
```vue
Tag 1OptionalClosable
```
--------------------------------
### Layout with Sider and Content
Source: https://github.com/view-design/viewuiplus/blob/master/_autodocs/api-reference/layout-components.md
Demonstrates a basic page layout using Layout, Sider, and Content components. The Sider is collapsible and triggers an event when its state changes.
```vue
Main content area
```