Skip to content

Commit d374c1f

Browse files
committed
doc: 重构参数
1 parent 8668428 commit d374c1f

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

src/components/BootstrapBlazor.Mermaid/Mermaid.razor.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,34 @@ public partial class Mermaid
4141
.AddClassFromAttributes(AdditionalAttributes)
4242
.Build();
4343

44+
/// <summary>
45+
/// <inheritdoc/>
46+
/// </summary>
47+
/// <returns></returns>
48+
protected override async Task OnParametersSetAsync()
49+
{
50+
await base.OnParametersSetAsync();
51+
await MermaidChanged();
52+
}
53+
54+
/// <summary>
55+
/// <inheritdoc/>
56+
/// </summary>
57+
/// <returns></returns>
58+
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, BuildDiagramText());
59+
60+
/// <summary>
61+
/// 内容改变时重新渲染mermaid
62+
/// </summary>
63+
/// <returns></returns>
64+
public Task MermaidChanged() => InvokeVoidAsync("init", Id, BuildDiagramText());
65+
66+
/// <summary>
67+
/// 导出图为 base64 字符串
68+
/// </summary>
69+
/// <returns>base64 string of the diagram</returns>
70+
public Task<string?> ExportBase64MermaidAsync() => InvokeAsync<string>("getContent", Id);
71+
4472
/// <summary>
4573
/// 构造 Mermaid 代码
4674
/// </summary>
@@ -72,32 +100,4 @@ private string BuildDiagramText()
72100
sb.Append(DiagramString);
73101
return sb.ToString();
74102
}
75-
76-
/// <summary>
77-
/// <inheritdoc/>
78-
/// </summary>
79-
/// <returns></returns>
80-
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, BuildDiagramText());
81-
82-
/// <summary>
83-
/// 导出图为 base64 字符串
84-
/// </summary>
85-
/// <returns>base64 string of the diagram</returns>
86-
public Task<string?> ExportBase64MermaidAsync() => InvokeAsync<string>("getContent", Id);
87-
88-
/// <summary>
89-
/// 内容改变时重新渲染mermaid
90-
/// </summary>
91-
/// <returns></returns>
92-
public Task MermaidChanged() => InvokeVoidAsync("init", Id, BuildDiagramText());
93-
94-
/// <summary>
95-
/// 内容改变时重新渲染mermaid
96-
/// </summary>
97-
/// <returns></returns>
98-
protected override async Task OnParametersSetAsync()
99-
{
100-
await base.OnParametersSetAsync();
101-
await MermaidChanged();
102-
}
103103
}

0 commit comments

Comments
 (0)