This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: 重构整个文档,提升用户体验,使用户能更好的查看示例和API (#312)
- Loading branch information
Showing
127 changed files
with
1,485 additions
and
1,180 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,84 @@ | ||
@{ | ||
var parameters = ApiDoc.GetParameterApiDoc(ComponentType); | ||
if ( parameters.Any() ) | ||
{ | ||
<h2>@(Name) 的参数</h2> | ||
<table class="t-table" style="margin-bottom:40px"> | ||
<thead> | ||
<tr> | ||
<th width="10%">名称</th> | ||
<th width="15%">数据类型</th> | ||
<th width="5%">默认值</th> | ||
<th>说明</th> | ||
<th width="100px">必填</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach ( var param in parameters ) | ||
{ | ||
<tr> | ||
<td style="font-weight:bolder;">@param.name</td> | ||
<td> | ||
@if ( string.IsNullOrEmpty(param.type) ) | ||
{ | ||
<TTag Theme="Theme.Danger">Unkonw</TTag> | ||
} | ||
else | ||
{ | ||
<code style="color:darkred">@param.type</code> | ||
} | ||
</td> | ||
<td> | ||
@param.defaultValue | ||
</td> | ||
<td>@param.comment</td> | ||
<td> | ||
@if ( param.requried ) | ||
{ | ||
<TTag Theme="Theme.Danger">Y</TTag> | ||
} | ||
else | ||
{ | ||
<TTag Type="TagType.Outline">N</TTag> | ||
} | ||
</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
|
||
var methods = ApiDoc.GetMethodApiDoc(ComponentType); | ||
if ( methods.Any() ) | ||
{ | ||
<h2 style="margin-top:40px">@(Name) 的方法</h2> | ||
<table class="t-table"> | ||
<thead> | ||
<tr> | ||
<th width="40%">方法</th> | ||
<th>说明</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach ( var item in methods ) | ||
{ | ||
<tr> | ||
<td style="font-weight:bolder;"> | ||
@($"{item.returnType} {item.name}({item.parameters})") | ||
</td> | ||
<td>@item.comment</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
} | ||
|
||
|
||
@code { | ||
[EditorRequired][Parameter] public Type ComponentType { get; set; } | ||
|
||
[Parameter]public string? Title{ get; set; } | ||
|
||
string Name => Title ?? ComponentType.Name; | ||
} |
This file was deleted.
Oops, something went wrong.
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,48 @@ | ||
|
||
<div style="margin-50px;"> | ||
<h1 style="font-size:36px;margin-bottom:20px; margin-top:40px; display:block;">@Title</h1> | ||
<p style="color:gray"> | ||
@Description | ||
</p> | ||
<TTab> | ||
<TTabItem Title="示例"> | ||
<TLayout style="height:75vh;overflow-y:auto"> | ||
<RightSideContent> | ||
@if ( Anchors is not null ) | ||
{ | ||
<div style="width:20vw;padding:10px;"> | ||
<TAnchor style="position: fixed;" Container="#page"> | ||
@foreach ( var item in Anchors ) | ||
{ | ||
<TAnchorItem Title="@item" Href="@("#"+item)"></TAnchorItem> | ||
} | ||
</TAnchor> | ||
</div> | ||
} | ||
</RightSideContent> | ||
<ChildContent> | ||
@ChildContent | ||
</ChildContent> | ||
</TLayout> | ||
</TTabItem> | ||
<TTabItem Title="API"> | ||
<div style="height:75vh;overflow-y:auto"> | ||
@if(ComponentType is not null) | ||
{ | ||
<ApiDocument ComponentType="@ComponentType"/> | ||
}else{ | ||
@ApiContent | ||
} | ||
</div> | ||
</TTabItem> | ||
</TTab> | ||
</div> | ||
|
||
@code { | ||
[Parameter] public string? Title { get; set; } | ||
[Parameter] public string? Description { get; set; } | ||
[Parameter] public RenderFragment? ChildContent { get; set; } | ||
[Parameter] public RenderFragment? ApiContent { get; set; } | ||
[Parameter] public string[]? Anchors { get; set; } | ||
[Parameter]public Type? ComponentType{ get; set; } | ||
} |
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
Oops, something went wrong.