-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(BrowserFinger): add BrowserFinger service sample code (#2862)
* chore: bump version 8.1.10-beta03 * doc: 增加指纹服务菜单 * doc: 更新源码映射配置 * doc: 更新示例 * doc: 移除指纹组件 * refactor: 增加指纹组件 * doc: 增加指纹浏览器示例 * refactor: 精简代码
- Loading branch information
Showing
11 changed files
with
117 additions
and
11 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -57,5 +57,3 @@ | |
</div> | ||
</div> | ||
</DemoBlock> | ||
|
||
<BrowserFinger></BrowserFinger> |
19 changes: 19 additions & 0 deletions
19
src/BootstrapBlazor.Server/Components/Samples/BrowserFingers.razor
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,19 @@ | ||
@page "/browser-finger" | ||
@inject IStringLocalizer<BrowserFingers> Localizer | ||
|
||
<DemoBlock Title="@Localizer["BrowserFingerTitle"]" Introduction="@Localizer["BrowserFingerIntro"]" ShowCode="false" Name="BrowserFinger"> | ||
<Pre>[Inject] | ||
[NotNull] | ||
private IBrowserFingerService? BrowserFingerService { get; set; } | ||
|
||
private async Task GetFingerCodeAsync() | ||
{ | ||
await BrowserFingerService.GetFingerCodeAsync(); | ||
}</Pre> | ||
<BootstrapInputGroup> | ||
<BootstrapInputGroupLabel DisplayText="Browser-Finger"></BootstrapInputGroupLabel> | ||
<BootstrapInput @bind-Value="@_code" /> | ||
</BootstrapInputGroup> | ||
</DemoBlock> | ||
|
||
<MethodTable Items="GetMethods()" /> |
45 changes: 45 additions & 0 deletions
45
src/BootstrapBlazor.Server/Components/Samples/BrowserFingers.razor.cs
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,45 @@ | ||
// Copyright (c) Argo Zhang ([email protected]). All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
// Website: https://www.blazor.zone or https://argozhang.github.io/ | ||
|
||
namespace BootstrapBlazor.Server.Components.Samples; | ||
|
||
/// <summary> | ||
/// 浏览器指纹服务示例 | ||
/// </summary> | ||
public partial class BrowserFingers | ||
{ | ||
[Inject] | ||
[NotNull] | ||
private IBrowserFingerService? BrowserFingerService { get; set; } | ||
|
||
private string? _code; | ||
|
||
/// <summary> | ||
/// <inheritdoc/> | ||
/// </summary> | ||
/// <returns></returns> | ||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
await base.OnAfterRenderAsync(firstRender); | ||
|
||
if (firstRender) | ||
{ | ||
_code = await GetFingerCodeAsync(); | ||
StateHasChanged(); | ||
} | ||
} | ||
|
||
private Task<string?> GetFingerCodeAsync() => BrowserFingerService.GetFingerCodeAsync(); | ||
|
||
private MethodItem[] GetMethods() => | ||
[ | ||
new() | ||
{ | ||
Name = "GetFingerCodeAsync", | ||
Description = Localizer["GetFingerCodeAsync"], | ||
Parameters = " — ", | ||
ReturnValue = "Task<string?>" | ||
} | ||
]; | ||
} |
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
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
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
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
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
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
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
4 changes: 0 additions & 4 deletions
4
src/BootstrapBlazor/Components/BrowserFinger/BrowserFinger.razor.js
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