1-状态体
说明。Typora,Markdown语法扩展(mermaid),绘制《状态图》的方法。
-
简洁
a
。 -
state "desc1" as A
。 -
A : desc2
。 -
举例。
stateDiagram a state "desc1" as b c : desc2

2-过渡
-
过渡
-->
。 -
开始和结束
[*]
。 -
举例。
stateDiagram a --> b c --> d: 备注说明 [*] --> e : 开始 f --> [*] : 结束

3-状态复合体
-
概念。一个状态内多个状态。
-
方法。
state A {...}
。 -
举例。
stateDiagram [*] --> a a --> b a --> c state a { [*] --> d d --> [*] } state b { [*] --> e e --> [*] } state c { [*] --> f f --> [*] }

4-分合器
-
概念。分叉和联结。
-
方法。
- 分叉
state xx <<fork>>
。 - 联结
state yy <<join>>
。
- 分叉
-
举例。
stateDiagram
state _fen <<fork>>
[*] --> _fen
_fen --> A
_fen --> B
state _he <<join>>
A --> _he
B --> _he
_he --> C
C --> [*]

5-备注
-
位置。
right
、left
。note left of A ... end note
note left of B: ...
-
举例。
stateDiagram
[*] --> A : start
A --> B
note left of A
我是A
end note
note right of B : 我是B
B --> [*]: end

6-简图
stateDiagram
[*] --> A
A --> [*]
A --> B
B --> A
B --> C
C --> [*]

网友评论