mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-02 12:09:59 +08:00
!672 feat(#I26CI5): 演示网站增加 WebsiteOptions 配置类用于统一设置域名链接地址
* doc: 更新图床地址 * doc: 使用 WebsiteOptions 配置类网址 * feat: 增加 WebsiteOptions 注入配置类 * doc: 更新菜单栏链接地址 * doc: 格式化文档
This commit is contained in:
parent
e2ff4b988b
commit
bf2b680f2e
@ -34,7 +34,7 @@
|
||||
|
||||
Products = Enumerable.Range(1, 20).Select(i => new Product()
|
||||
{
|
||||
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
|
||||
ImageUrl = $"https://imgs.blazor.zone/images/Pic{i}.jpg",
|
||||
Description = $"Pic{i}.jpg"
|
||||
});
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
Products = Enumerable.Range(1, 100).Select(i => new Product()
|
||||
{
|
||||
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
|
||||
ImageUrl = $"https://imgs.blazor.zone/images/Pic{i}.jpg",
|
||||
Description = $"Pic{i}.jpg"
|
||||
});
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
Products = Enumerable.Range(1, 100).Select(i => new Product()
|
||||
{
|
||||
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
|
||||
ImageUrl = $"https://imgs.blazor.zone/images/Pic{i}.jpg",
|
||||
Description = $"Pic{i}.jpg"
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BootstrapBlazor.Shared.Data;
|
||||
using BootstrapBlazor.Shared;
|
||||
using BootstrapBlazor.Shared.Data;
|
||||
using Longbow.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
@ -31,6 +32,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
});
|
||||
services.AddVersionManager();
|
||||
services.AddExampleService();
|
||||
services.AddSingleton<WebsiteOptions>();
|
||||
services.AddHostedService<BlazorBackgroundServices>();
|
||||
return services;
|
||||
}
|
||||
|
25
src/BootstrapBlazor.Shared/Extensions/WebsiteOptions.cs
Normal file
25
src/BootstrapBlazor.Shared/Extensions/WebsiteOptions.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace BootstrapBlazor.Shared
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class WebsiteOptions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ServerUrl { get; set; } = "https://www.blazor.zone";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string WasmUrl { get; set; } = "https://wasm.blazor.zone";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string AdminUrl { get; set; } = "https://admin.blazor.zone";
|
||||
|
||||
public string ImageLibUrl { get; set; } = "https://imgs.blazor.zone";
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
@page "/docs"
|
||||
@page "/introduction"
|
||||
|
||||
@inject WebsiteOptions WebsiteOption
|
||||
<h3>简介</h3>
|
||||
|
||||
<p>BootstrapBlazor 是一套 Bootstrap 风格的 Blazor UI 组件库,可以认为是 Bootstrap 项目的 Blazor 版实现。</p>
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
<p>国内最大代码托管协作开发平台 <b><a href="https://gitee.com/LongbowEnterprise/BootstrapBlazor" target="_blank">码云</a></b> C# 板块最高星 <a href='https://gitee.com/LongbowEnterprise/BootstrapAdmin/stargazers'><img src='https://gitee.com/LongbowEnterprise/BootstrapAdmin/badge/star.svg?theme=gvp' alt='star' style="margin-bottom: 1px;" /></a> 作品 <b><a href="https://gitee.com/LongbowEnterprise/BootstrapAdmin" target="_blank">通用后台管理系统 BootstrapAdmin</a></b> 准备使用本组件实现全部功能</p>
|
||||
|
||||
<p>演示网站:<a href="https://ba.sdgxgz.com/Pages" target="_blank">https://ba.sdgxgz.com</a></p>
|
||||
<p>演示网站:<a href="@($"{WebsiteOption.AdminUrl}/Pages")" target="_blank">@WebsiteOption.AdminUrl</a></p>
|
||||
|
||||
<h4>快速上手</h4>
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
@page "/listviews"
|
||||
@inject WebsiteOptions WebsiteOption
|
||||
|
||||
<h3>ListView 列表视图</h3>
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace BootstrapBlazor.Shared.Pages
|
||||
|
||||
Products = Enumerable.Range(1, 100).Select(i => new Product()
|
||||
{
|
||||
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
|
||||
ImageUrl = $"{WebsiteOption.ImageLibUrl}/images/Pic{i}.jpg",
|
||||
Description = $"Pic{i}.jpg",
|
||||
Category = $"Group{(i % 4) + 1}"
|
||||
});
|
||||
|
@ -1,4 +1,5 @@
|
||||
@page "/navs"
|
||||
@inject WebsiteOptions WebsiteOption
|
||||
|
||||
<h3>Nav 导航组件</h3>
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace BootstrapBlazor.Shared.Pages
|
||||
var link = new NavLink();
|
||||
link.SetParametersAsync(ParameterView.FromDictionary(new Dictionary<string, object>()
|
||||
{
|
||||
["href"] = "http://ba.sdgxgz.com",
|
||||
["href"] = WebsiteOption.AdminUrl,
|
||||
["class"] = "nav-link nav-item",
|
||||
["target"] = "_blank",
|
||||
["ChildContent"] = new RenderFragment(builder =>
|
||||
|
@ -1,6 +1,7 @@
|
||||
@using System.Diagnostics.CodeAnalysis
|
||||
@inherits LayoutComponentBase
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject WebsiteOptions WebsiteOption
|
||||
|
||||
<header class="navbar navbar-expand navbar-dark flex-column flex-md-row">
|
||||
<div class="header-img navbar-brand">
|
||||
@ -19,10 +20,10 @@
|
||||
<a class="nav-link" href="components">组件</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="http://blazor.sdgxgz.com/" title="WebAssembly Server">server</a>
|
||||
<a class="nav-link" href="@WebsiteOption.ServerUrl" title="Server">server</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="http://wasm.sdgxgz.com/" title="WebAssembly Client">wasm</a>
|
||||
<a class="nav-link" href="@WebsiteOption.WasmUrl" title="WebAssembly Client">wasm</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -42,6 +42,8 @@ namespace BootstrapBlazor.WebAssembly.ClientHost
|
||||
|
||||
builder.Services.AddSingleton<WeatherForecastService>();
|
||||
|
||||
builder.Services.AddSingleton<WebsiteOptions>();
|
||||
|
||||
builder.Services.AddSingleton<ICultureStorage, DefaultCultureStorage>();
|
||||
|
||||
var host = builder.Build();
|
||||
|
Loading…
Reference in New Issue
Block a user