Skip to content

Commit fca606b

Browse files
committed
doc: 更新定位器文档
1 parent 512f25c commit fca606b

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

src/BootstrapBlazor.Server/Components/Samples/Locators.razor

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ private IIpLocatorFactory? IpLocatorFactory { get; set; }
1717
</Tips>
1818
<Pre>Encoding.RegisterProvider(CodePagesEncodingProvider.Instance)</Pre>
1919
<p><b>@Localizer["LocatorsNormalExtendDescription"]</b></p>
20+
2021
<p><b>@Localizer["LocatorsNormalExtend1"]</b></p>
2122
<Pre>private class CustomerLocatorProvider : DefaultIpLocatorProvider
2223
{
@@ -25,35 +26,20 @@ private IIpLocatorFactory? IpLocatorFactory { get; set; }
2526
throw new NotImplementedException();
2627
}
2728
}</Pre>
29+
2830
<p><b>@Localizer["LocatorsNormalExtend2"]</b></p>
2931
<Pre>services.AddSingleton&lt;IIpLocatorProvider, CustomerLocatorProvider&gt;();</Pre>
3032
<p>@((MarkupString)Localizer["LocatorsNormalCustomerLocator"].Value)</p>
33+
34+
<p><b>@Localizer["LocatorsNormalExtend3"]</b></p>
35+
<Pre>var provider = IpLocatorFactory.Create(ProviderName);
36+
Location = await provider.Locate(Ip);</Pre>
37+
3138
<p>@Localizer["LocatorsNormalIpTitle"]</p>
3239
<p><code>112.224.74.239</code> @Localizer["LocatorsNormalTips3"]</p>
3340
<p><code>183.160.236.53</code> @Localizer["LocatorsNormalTips4"]</p>
3441

3542
<DemoBlock Title="@Localizer["LocatorsNormalTitle"]" Introduction="@Localizer["LocatorsNormalIntro"]" Name="Normal">
36-
<section ignore>
37-
@((MarkupString)Localizer["LocatorsProviderDesc"].Value)
38-
<Tips>
39-
<p>@((MarkupString)Localizer["LocatorsProviderOptions"].Value)</p>
40-
</Tips>
41-
<Pre>{
42-
"BootstrapBlazorOptions": {
43-
"WebClientOptions": {
44-
"EnableIpLocator": true
45-
}
46-
}
47-
}</Pre>
48-
<Pre>services.AddBootstrapBlazor(op =>
49-
{
50-
op.WebClientOptions.EnableIpLocator = true;
51-
});</Pre>
52-
<Pre>services.Configure&lt;BootstrapBlazorOptions&gt;(op =>
53-
{
54-
op.WebClientOptions.EnableIpLocator = true;
55-
});</Pre>
56-
</section>
5743
<div class="row g-3 form-inline">
5844
<div class="col-12 col-sm-6">
5945
<Select Items="_providers" Value="@ProviderName" OnValueChanged="OnProviderNameChanged" ShowLabel="true" DisplayText="LocatorProvider">

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,6 +4095,7 @@
40954095
"LocatorsNormalExtendDescription": "Extend the custom geo-location query interface",
40964096
"LocatorsNormalExtend1": "1. Implement a custom locator",
40974097
"LocatorsNormalExtend2": "2. Configure a custom locator",
4098+
"LocatorsNormalExtend3": "3. Use locator",
40984099
"LocatorsNormalCustomerLocator": "Add <code>CustomerLocatorProvider</code> to the service container using the <code>AddSingleton</code> method",
40994100
"LocatorsNormalIpTitle": "IP test data",
41004101
"LocatorsNormalTips3": "Shandong, China Unicom",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,6 +4095,7 @@
40954095
"LocatorsNormalExtendDescription": "扩展自定义地理位置查询接口",
40964096
"LocatorsNormalExtend1": "1. 实现自定义定位器",
40974097
"LocatorsNormalExtend2": "2. 配置自定义定位器",
4098+
"LocatorsNormalExtend3": "3. 通过定位器定位",
40984099
"LocatorsNormalCustomerLocator": "通过 <code>AddSingleton</code> 方法将自定义定位器 <code>CustomerLocatorProvider</code> 添加到服务容器中",
40994100
"LocatorsNormalIpTitle": "IP 测试数据",
41004101
"LocatorsNormalTips3": "山东省 中国联通",

0 commit comments

Comments
 (0)