-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
sidebar_position: 10 | ||
--- | ||
|
||
# 10.1. monaco-editor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}; | ||
}, []); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters