Skip to content

Commit

Permalink
📝 docs(PageStack): improve the api doc (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored Aug 16, 2024
1 parent 8486f27 commit 4e58296
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/Masa.Blazor.Docs/Shared/PageStackLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<MApp>
<MMain>
<PPageStack TabbedPatterns="@_tabbedPatterns">
<PPageStack TabbedPatterns="@_tabbedPatterns"
FallbackUri="/blazor/examples/page-stack/tab1">
<MContainer>
@Body
</MContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"props": {
"fallbackUri": "In the stack page, if there is no previous page after clicking the return button in the upper left corner, the page to jump to",
"name": "The unique name of PageStackNavController. Only need to be set when there are multiple stack components in your application",
"tabbedPatterns": "A regular expression representing a group of pages that are bottom tabbed pages, used to distinguish pages of stack pages"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"props": {
"fallbackUri": "在堆栈页时,点击左上角的返回按钮后如果没有上一页则跳转的页面",
"name": "PageStackNavController 的唯一名称。仅当你的应用中有多个堆栈组件时才需要设置",
"tabbedPatterns": "一组表示是底部标签栏的页面的正则表达式,用于区别堆栈页的页面",
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": {
"path": "app-bars/MAppBar"
},
"props": {
"centerTitle": "Determine whether the title is centered",
"image": "Background image of the title bar",
"title": "Title of the title bar",
"rerenderKey": "A key to determine whether to force re-render the bar"
},
"contents": {
"actionContent": "Customize the right operation area of the title bar",
"barContent": "Customize the entire title bar",
"goBackContent": "Customize the return button area",
"imageContent": "Customize the background image area"
},
"methods": {
"rerender": "Force to re-render the bar"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": {
"path": "app-bars/MAppBar"
},
"props": {
"centerTitle": "居中显示标题",
"image": "标题栏背景图片",
"title": "标题栏标题",
"rerenderKey": "强制刷新标识"
},
"contents": {
"actionContent": "自定义标题栏右侧操作区域",
"barContent": "自定义整个标题栏",
"goBackContent": "自定义返回按钮区域",
"imageContent": "自定义标题栏背景图片"
},
"methods": {
"rerender": "强制刷新"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"events": {
"PageClosed": "a event occurs when a stack page is closed"
},
"methods": {
"Push": "push a new page onto the page stack",
"Pop": "Go back one step in the page stack",
"goBack": "Go back the specified number of steps in the page stack",
"goBackAndReplace": "Go back to specified number of steps in the page stack, and then invoke the Replace method",
"goBackToPage": "Go back to the specified page in the page stack. If the page is not found, do nothing",
"goBackToPageAndReplace": "Go back to the specified page in the page stack and then invoke the Replace method",
"Replace": "Replace the current page with a new page",
"Clear": "Clear the page stack",
"goBackToTab": "Clear current page stack and navigate to a tab"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"events": {
"PageClosed": "当堆栈页面关闭时触发"
},
"methods": {
"Push": "将新页面推送到页面堆栈",
"Pop": "在页面堆栈中后退一步",
"goBack": "在页面堆栈中后退指定步数",
"goBackAndReplace": "在页面堆栈中后退指定步数,然后调用Replace方法",
"goBackToPage": "在页面堆栈中后退到指定页面。如果未找到页面,则不执行任何操作",
"goBackToPageAndReplace": "在页面堆栈中后退到指定页面,然后调用Replace方法",
"Replace": "用新页面替换当前页面",
"Clear": "清除页面堆栈",
"goBackToTab": "清除当前页面堆栈并导航到选项卡"
}
}
49 changes: 49 additions & 0 deletions docs/Masa.Blazor.Docs/wwwroot/data/other-apis.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,54 @@
}
]
}
},
{
"name": "PageStackNavController",
"parameters": {
"events": [
{
"name": "PageClosed",
"type": "EventHandler<PageStackPageClosedEventArgs>"
}
],
"methods": [
{
"name": "Push",
"type": "(string relativeUri) => void"
},
{
"name": "Pop",
"type": "(object? state = null) => void"
},
{
"name": "GoBack",
"type": "(int delta = 1, object? state = null) => void"
},
{
"name": "GoBackAndReplace",
"type": "(int delta, string? replaceUri, object? state = null) => void"
},
{
"name": "GoBackToPage",
"type": "(string absolutePath, object? state = null) => void"
},
{
"name": "GoBackToPageAndReplace",
"type": "(string absolutePath, string replaceUri, object? state = null) => void"
},
{
"name": "Replace",
"type": "(string relativeUri, object? state = null) => void"
},
{
"name": "Clear",
"type": "() => void"
},
{
"name": "GoBackToTab",
"type": "(string relativeUri) => void"
}
]
}
}
]
3 changes: 2 additions & 1 deletion docs/Masa.Blazor.Docs/wwwroot/data/page-to-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@
],
"page-stack": [
"PPageStack",
"PPageStackItemInit"
"PStackPageBarInit",
"PageStackNavController"
],
"page-tabs": [
"PPageTabs",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: PDF Mobile Viewer
desc: "A PDF viewer designed for mobile."
tag: "JS Proxy"
---

Before using, you need to include the style sheet:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: PDF Mobile Viewer(PDF 移动端查看器)
desc: "专为移动设备设计的 PDF 查看器。"
tag: "JS代理"
---

在使用之前,需要引入样式表:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void Clear()
}

/// <summary>
/// Clear current page stack and navigate to the new tab.
/// Clear current page stack and navigate to a tab.
/// </summary>
/// <param name="relativeUri"></param>
[Obsolete("Use GoBackToTab instead.")]
Expand All @@ -136,7 +136,7 @@ public void GoToTab(string relativeUri)
}

/// <summary>
/// Clear current page stack and navigate to the new tab.
/// Clear current page stack and navigate to a tab.
/// </summary>
/// <param name="relativeUri"></param>
public void GoBackToTab(string relativeUri)
Expand Down
2 changes: 0 additions & 2 deletions src/Masa.Blazor/Presets/PageStack/PPageStack.razor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Masa.Blazor.Presets.PageStack;
using Masa.Blazor.Presets.PageStack.NavController;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;

namespace Masa.Blazor.Presets;

Expand Down

0 comments on commit 4e58296

Please sign in to comment.