Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复状态文档中关于状态样式示例代码错误 #5875

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions packages/site/docs/manual/core-concept/state.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,24 @@ Currently, G6 supports configuring state styles within style mappings, for examp
{
node: {
style: {/** Default State Style */},
selected: {/** Selected State Style */},
[State name]: {/** State Style */}
state: {
selected: {/** Selected State Style */},
[State name]: {/** State Style */}
}
},
edge: {
style: {/** Default State Style */},
selected: {/** Selected State Style */},
[State name]: {/** State Style */}
style: {/** Default State Style */},
state: {
selected: {/** Selected State Style */},
[State name]: {/** State Style */}
}
},
combo: {
style: {/** Default State Style */},
selected: {/** Selected State Style */},
[State name]: {/** State Style */}
state: {
selected: {/** Selected State Style */},
[State name]: {/** State Style */}
}
}
}
```
Expand Down Expand Up @@ -136,7 +142,9 @@ To customize states, simply add them to the style mapping, for example:
{
node: {
// Custom state name: 'custom-state'
'custom-state': {/** Custom State Style */}
state: {
'custom-state': {/** Custom State Style */}
}
},
}
```
Expand Down
24 changes: 16 additions & 8 deletions packages/site/docs/manual/core-concept/state.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ order: 3

## 状态类型

G6 中的状态类型是一个字符串数组(`number[]`),即一个元素可以同时存在多个状态,例如一个节点可以同时处于**选中**和**悬停**状态。
G6 中的状态类型是一个字符串数组(`string[]`),即一个元素可以同时存在多个状态,例如一个节点可以同时处于**选中**和**悬停**状态。

G6 预设的状态包括:

Expand All @@ -38,18 +38,24 @@ G6 预设的状态包括:
{
node: {
style: {/** 默认状态样式 */},
selected: {/** 选中状态样式 */},
[状态名]: {/** 状态样式 */}
state: {
selected: {/** 选中状态样式 */},
[状态名]: {/** 状态样式 */}
}
},
edge: {
style: {/** 默认状态样式 */},
selected: {/** 选中状态样式 */},
[状态名]: {/** 状态样式 */}
state: {
selected: {/** 选中状态样式 */},
[状态名]: {/** 状态样式 */}
}
},
combo: {
style: {/** 默认状态样式 */},
selected: {/** 选中状态样式 */},
[状态名]: {/** 状态样式 */}
state: {
selected: {/** 选中状态样式 */},
[状态名]: {/** 状态样式 */}
}
}
}
```
Expand Down Expand Up @@ -137,7 +143,9 @@ graph.setElementState('node-1', []);
{
node: {
// 自定义状态名为:'custom-state'
'custom-state': {/** 自定义状态样式 */}
state: {
'custom-state': {/** 自定义状态样式 */}
}
},
}
```
Expand Down
Loading