Skip to content

Commit

Permalink
add: 添加社区组件文档
Browse files Browse the repository at this point in the history
  • Loading branch information
hzm0321 committed Mar 7, 2023
1 parent 47e21fe commit 41ab71e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/10.community/10.1.monaco-editor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 10
---

# 10.1. monaco-editor
45 changes: 45 additions & 0 deletions docs/10.community/10.2.antv_x6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
sidebar_position: 10
---

# 10.2. antv/x6

### 10.2.1. 注册
x6 提供了注册布局、节点、边、工具栏、右键菜单等功能,但这些功能都是挂载在全局的。因此,**在退出组件的时候应当同时销毁挂载在全局的内容**,以免对其他组件造成影响。

推荐对于注册的内容,使用方法进行封装,并在返回值中包含销毁方法,以便在组件销毁时调用。例:

```tsx
/**
* 注册 ER 图连接桩布局
*/
export function registerERPortLayout() {
// This will right
Graph.registerPortLayout(
ER_PORT_LAYOUT,
(portsPositionArgs) => {
return portsPositionArgs.map((_, index) => {
return {
position: {
x: 0,
y: (index + 1) * ER_LINE_HEIGHT,
},
angle: 0,
};
});
},
true
);
// This will right
return () => Graph.unregisterPortLayout(ER_PORT_LAYOUT);
}

// 使用
useEffect(() => {
const unregister = registerERPortLayout();
return () => {
unregister();
};
}, []);
```

9 changes: 9 additions & 0 deletions docs/10.community/10.community.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_position: 10
---

# 10. 社区组件

此篇主要总结一些项目上所用到的社区精选组件,以及对应的使用规范。

<maintainer authors={["hzm"]}/>
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/9.business/9.business.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ sidebar_position: 9

- [公共业务组件](./business/9.1.components)`src/components`
- [公共 hooks](./business/9.2.hooks)`src/hooks`
- 公共 工具库`src/utils`
- [公共工具库](./business/9.3.utils)`src/utils`

<maintainer authors={["hzm"]}/>

0 comments on commit 41ab71e

Please sign in to comment.