# yh-x6

> 对于 antdv X6 的封装

Latest version **1.0.11** (published 2026-07-01) · 0 weekly downloads

## Install

```sh
npm install yh-x6
pnpm add yh-x6
yarn add yh-x6
bun add yh-x6
```

## Health

**Score 50/100 (C)** — status: active.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2026-07-01 |
| First published | 2023-11-28 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 19.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Liubin |
| Maintainers | lkyh_fe |

## Links

- npm: https://www.npmjs.com/package/yh-x6
- npm.io page: https://npm.io/package/yh-x6

## Dependencies (12)

- [@antv/x6](https://npm.io/package/@antv/x6.md) ^2.11.1
- [@antv/x6-vue-shape](https://npm.io/package/@antv/x6-vue-shape.md) ^2.1.2
- [@antv/x6-plugin-dnd](https://npm.io/package/@antv/x6-plugin-dnd.md) ^2.0.5
- [@antv/x6-plugin-history](https://npm.io/package/@antv/x6-plugin-history.md) ^2.2.3
- [@antv/x6-plugin-minimap](https://npm.io/package/@antv/x6-plugin-minimap.md) ^2.0.5
- [@antv/x6-plugin-stencil](https://npm.io/package/@antv/x6-plugin-stencil.md) ^2.1.5
- [@antv/x6-plugin-keyboard](https://npm.io/package/@antv/x6-plugin-keyboard.md) ^2.2.1
- [@antv/x6-plugin-scroller](https://npm.io/package/@antv/x6-plugin-scroller.md) ^2.0.9
- [@antv/x6-plugin-snapline](https://npm.io/package/@antv/x6-plugin-snapline.md) ^2.1.7
- [@antv/x6-plugin-clipboard](https://npm.io/package/@antv/x6-plugin-clipboard.md) ^2.1.6
- [@antv/x6-plugin-selection](https://npm.io/package/@antv/x6-plugin-selection.md) ^2.1.7
- [@antv/x6-plugin-transform](https://npm.io/package/@antv/x6-plugin-transform.md) ^2.1.7

## Recent versions

- 1.0.11 (latest) — 2026-07-01
- 1.0.8 — 2026-07-01
- 1.0.7 — 2026-07-01
- 1.0.6 — 2025-11-03
- 1.0.5 — 2025-06-19
- 1.0.3 — 2025-04-08
- 1.0.2 — 2025-04-08
- 1.0.1 — 2023-11-28

## README

## yh-x6

力控元海技术中心封装的 Antdv X6

## 安装

配置好[云效NPM私有仓库](https://packages.aliyun.com/npm/npm-registry/guide)后,直接执行如下命令安装
```shell
npm install yh-x6
```

## 使用

### 自定义节点挂载点

**在布局根节点插入 Teleport 节点，用来渲染自定义Vue节点**  
*新模板中布局根节点分别位于两个位置：*
- `src/layout/admin/adminIndex.vue`
- `src/layout/main/main.vue`

```html
<template>
  ......
  <TeleportContainer></TeleportContainer>
</template>
```

### 自定义节点

此封装除了支持 X6 内置的svg 节点外，还内置了四个Vue节点以供使用:  

- flowStart 开始节点
- flowEnd 结束节点
- flowNode 普通节点
- flowQuestion 告警节点

引入方式如下
```javascript
import {
  flowStart,
  flowEnd,
  flowNode,
  flowQuestion
} from "yh-x6"
```

### 挂载画布

画布的挂载被封装成了 vue3 hooks，使用方式如下
```javascript
const { selectedCells, graph, dnd } = useX6(
  flowCanvasContainer, // 挂载容器的 Ref 引用
  (sourceCell) => {}, // 手动连线时
  () => {} // x6 初始化并挂在后执行的回调函数
)
```

---
_Source: https://npm.io/package/yh-x6 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
