### Install PlusProComponents with yarn
Source: https://plus-pro-components.com/guide/installation
Use this command to install the library with yarn. Ensure you have yarn installed.
```sh
yarn add plus-pro-components
```
--------------------------------
### Install PlusProComponents with npm
Source: https://plus-pro-components.com/guide/installation
Use this command to install the library with npm. Ensure you have npm installed.
```sh
npm install plus-pro-components --save
```
--------------------------------
### Install PlusProComponents with pnpm
Source: https://plus-pro-components.com/guide/installation
Use this command to install the library with pnpm. Ensure you have pnpm installed.
```sh
pnpm install plus-pro-components
```
--------------------------------
### Install @plus-pro-components/utils with npm
Source: https://plus-pro-components.com/api/utils
Use this command to install the utility package using npm.
```sh
npm install @plus-pro-components/utils --save
```
--------------------------------
### Install @plus-pro-components/utils with yarn
Source: https://plus-pro-components.com/api/utils
Use this command to install the utility package using yarn.
```sh
yarn add @plus-pro-components/utils
```
--------------------------------
### Install @plus-pro-components/utils with pnpm
Source: https://plus-pro-components.com/api/utils
Use this command to install the utility package using pnpm.
```sh
pnpm install @plus-pro-components/utils
```
--------------------------------
### DatePicker Basic Usage
Source: https://plus-pro-components.com/components/date-picker
Demonstrates the basic integration of the DatePicker component. No specific setup or imports are shown in this example.
```vue
```
--------------------------------
### Layout Event Handling Example
Source: https://plus-pro-components.com/components/layout
Shows how to handle events emitted by the PlusSidebar and PlusHeader components within the PlusLayout. Ensure the corresponding handler functions are defined in your setup.
```html
```
```typescript
const handleClickDropdownItem = (dropdownItem: { label: string; value: string }) => {
console.log(dropdownItem)
}
const handleToggleCollapse = (collapse: boolean) => {
console.log(collapse)
}
```
--------------------------------
### Install @plus-pro-components/resolver
Source: https://plus-pro-components.com/ecosystem/resolver
Install the resolver package using pnpm. This is the first step to enable automatic component imports.
```sh
pnpm i @plus-pro-components/resolver
```
--------------------------------
### Basic InputTag Usage
Source: https://plus-pro-components.com/components/input-tag
Demonstrates the fundamental usage of the InputTag component. No specific setup or constraints are mentioned for this basic example.
```vue
```
--------------------------------
### Advanced Table Example
Source: https://plus-pro-components.com/components/table
Demonstrates an advanced usage example of the PlusTable component, combining various customization options.
```APIDOC
## Advanced Table
:::demo
table/advanced
:::
```
--------------------------------
### Implement a Basic PlusForm
Source: https://plus-pro-components.com/components/form.html
A comprehensive example showing form state management, column definitions with various value types, and event handling.
```vue
```
--------------------------------
### Overall Render Function Example
Source: https://plus-pro-components.com/components/rule
Demonstrates using an overall render function to apply the same rendering logic to all items in a loop. The `allRender` function is used to generate the VNode for each item.
```html
```
--------------------------------
### Layout Basic Usage
Source: https://plus-pro-components.com/components/layout
Demonstrates the basic integration of the PlusLayout component. This snippet is intended for initial setup and understanding of the component's structure.
```html
```
--------------------------------
### Individual Render Function Example
Source: https://plus-pro-components.com/components/rule
Illustrates using individual render functions for each item in a loop, allowing for different rendering logic per item. Each item in the `list` has a `render` property that defines its specific VNode.
```html
```
--------------------------------
### Basic Radio Usage
Source: https://plus-pro-components.com/components/radio
Demonstrates the fundamental usage of the PlusRadio component. No specific setup is required beyond importing the component.
```vue
```
--------------------------------
### Use AES Encryption
Source: https://plus-pro-components.com/api/utils/encrypt
Example usage of the encrypt function.
```typescript
import { encrypt } from '@plus-pro-components/utils'
encrypt('key', 'message') // U2FsdGVkX19GcnbMMQplTX7ZrBomhN24tzbA5Nlc1dw=
```
--------------------------------
### DisplayItem Basic Usage
Source: https://plus-pro-components.com/components/display-item
Demonstrates the basic rendering of the DisplayItem component. No specific setup is required beyond its inclusion in a PlusTable.
```vue
```
--------------------------------
### Format Money Utility
Source: https://plus-pro-components.com/api/utils
Import and use the formatMoney function to format currency values. Ensure the package is installed and imported correctly.
```ts
import { formatMoney } from '@plus-pro-components/utils'
formatMoney('100') // ¥100.00
```
--------------------------------
### Storage Utility Functions
Source: https://plus-pro-components.com/api/utils/storage
Functions for setting, getting, and removing data from localStorage.
```APIDOC
## setStorage
### Description
Sets a value in localStorage.
### Parameters
- **key** (string) - Required - The storage key.
- **value** (any) - Required - The data to store.
## getStorage
### Description
Retrieves a value from localStorage.
### Parameters
- **key** (string) - Required - The storage key.
## removeStorage
### Description
Removes an item from localStorage.
### Parameters
- **key** (string) - Required - The storage key to remove.
```
--------------------------------
### Basic StepsForm Usage
Source: https://plus-pro-components.com/components/steps-form
Demonstrates the fundamental usage of the StepsForm component. Set the 'active' prop to control the current step (starting from 1) and provide 'data' for the form fields.
```vue
```
--------------------------------
### ElTable Attributes Example
Source: https://plus-pro-components.com/components/table
Demonstrates how to use common ElTable attributes like stripe, border, and fit with the PlusTable component. These attributes control the visual appearance and behavior of the table.
```html
```
--------------------------------
### Basic Header Usage
Source: https://plus-pro-components.com/components/header
Demonstrates the basic implementation of the PlusHeader component.
```vue
```
--------------------------------
### Disable Start Date Logic
Source: https://plus-pro-components.com/components/date-picker
Use this function to determine if a start date should be disabled. It returns true if the start time is after the provided end value.
```javascript
const startDisabledDate = (startTime, endValue) => {
if (!endValue) return false
return startTime.getTime() > new Date(endValue).getTime()
}
```
--------------------------------
### 项目目录结构
Source: https://plus-pro-components.com/guide/dev
展示了 PlusProComponents 项目的根目录结构及各文件夹的功能说明。
```sh
├── CHANGELOG.md #changelog文件
├── commitlint.config.js #commitlint配置
├── docs #文档所在目录
| ├── .vitepress #vitepress配置
| ├── components #组件文档
| ├── examples #组件文档对应的vue示例
| ├── deploy.sh #文档部署脚本
| ├── guide #快速开始文档
| ├── index.md #文档首页
| ├── package.json
| ├── public
| └── utils
├── global.d.ts #全局组件ts提示
├── LICENSE #LICENSE 文件
├── package.json
├── packages #包文件夹
| ├── components #主组件
| ├── constants #固定变量
| ├── eslint-config #eslint配置独立
| ├── hooks #hooks
| ├── locale #国际化
| ├── play #组件实时预览
| ├── plus-pro-components #主包入口
| ├── utils #工具
| ├── theme-chalk #样式
| └── types #公共TS类型
├── pnpm-lock.yaml
├── pnpm-workspace.yaml #工作空间配置
├── README.md #项目介绍
├── scripts #脚本
| ├── build #主包打包
| ├── changelog #changelog
| ├── create-component #新增组件
| ├── release #整包release
| ├── utils #公共打包工具
| ├── commit.sh #代码提交
| └── publish.sh #整包发布
├── tsconfig.base.json #tsconfig配置
├── tsconfig.json
├── tsconfig.node.json
├── tsconfig.vitest.json
├── tsconfig.web.json
├── typings #全局d.ts
| └── env.d.ts
└── vitest.config.ts #vitest配置
```
--------------------------------
### Get Decrypted Token
Source: https://plus-pro-components.com/api/utils/storage
Retrieves and decrypts a token from localStorage using AES. Provide the key to get the decrypted token string.
```typescript
/**
* 获取token 带AES解密
* @returns token
*/
declare function getToken(key: string): string
```
```typescript
import { getToken } from '@plus-pro-components/utils'
getToken('tokenKey') // 'token'
```
--------------------------------
### openExe
Source: https://plus-pro-components.com/api/utils/other
Opens a local application on the computer using a specified protocol.
```APIDOC
## openExe
### Description
Opens a local application on the computer by invoking its protocol handler.
### Method
POST (conceptual, as it triggers an action)
### Endpoint
N/A (Client-side function)
### Parameters
- **protocol** (string) - Required - The protocol of the local application (e.g., `vscode://`).
- **event** (Event) - Required - The click event from an element (e.g., `el-button` or native `button`).
- **timeout** (number) - Optional - The timeout in milliseconds to consider the open action failed if no response is received. Defaults to 1000ms.
### Request Example
```html
```
```javascript
import { openExe } from '@plus-pro-components/utils';
const url = 'vscode://';
const handleClick = async (event) => {
try {
await openExe(url, event, 2000); // 2 second timeout
console.log('Application opened successfully.');
} catch (error) {
console.error('Failed to open application:', error);
}
};
```
### Response
#### Success Response (200)
- **FocusEvent** - A FocusEvent object if the application is successfully launched or focused.
#### Response Example
(This is a conceptual example as the actual response is an event object)
```json
{
"type": "focus",
"target": "