diff --git a/README.md b/README.md index 9dd7092f4..39787e834 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ English | 中文 `dotnet add package BootstrapBlazor` -2. **Add** the `stylesheet` `javascripts` file to your main index file - `~/Pages/_Host.cshtml` +2. **Add** the `stylesheet` `javascripts` file to your main index file - `Pages/_Host.cshtml (Server)` or `wwwroot/index.html (WebAssembly)` **HTML** diff --git a/src/BootstrapBlazor.Shared/Extensions/WebsiteOptions.cs b/src/BootstrapBlazor.Shared/Extensions/WebsiteOptions.cs index c67bb985b..bf966e499 100644 --- a/src/BootstrapBlazor.Shared/Extensions/WebsiteOptions.cs +++ b/src/BootstrapBlazor.Shared/Extensions/WebsiteOptions.cs @@ -20,6 +20,9 @@ /// public string AdminUrl { get; set; } = "https://admin.blazor.zone"; + /// + /// + /// public string ImageLibUrl { get; set; } = "https://imgs.blazor.zone"; } } diff --git a/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor b/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor index bdff83e19..eb7878bc6 100644 --- a/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor +++ b/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor @@ -12,7 +12,7 @@

CSS 文件

-

将 Bootstrap 的 CSS 文件以 <link> 标签的形式添加到 <head> 标签中,并放置在所有其它样式表之前。

+

将 Bootstrap 的 CSS 文件以 <link> 标签的形式添加到 @HostFile 文件 <head> 标签中,并放置在所有其它样式表之前。


 
@@ -23,7 +23,7 @@
 
 

JS 文件

-

Bootstrap 所提供的许多组件都依赖 JavaScript 才能运行。具体来说,这些组件都依赖 jQuery、Popper.js 以及我们自己的 JavaScript 插件。将以下 <script> 标签放到页面尾部且在 </body> 标签之前即可起作用。

+

Bootstrap 所提供的许多组件都依赖 JavaScript 才能运行。具体来说,这些组件都依赖 jQuery、Popper.js 以及我们自己的 JavaScript 插件。将以下 <script> 标签放到 >@HostFile 文件尾部且在 </body> 标签之前即可起作用。


 
 

添加命名空间到 _Imports.razor 文件

diff --git a/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor.cs b/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor.cs index a220faa00..ad69f5f28 100644 --- a/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor.cs +++ b/src/BootstrapBlazor.Shared/Pages/Components/InstallContent.razor.cs @@ -19,6 +19,12 @@ namespace BootstrapBlazor.Shared.Pages.Components [Parameter] public string Title { get; set; } = "服务器端渲染模式"; + /// + /// + /// + [Parameter] + public string HostFile { get; set; } = "Pages/_Host.cshtml"; + /// /// /// diff --git a/src/BootstrapBlazor.Shared/Pages/Install_wasm.razor b/src/BootstrapBlazor.Shared/Pages/Install_wasm.razor index d5f1113a2..33b2c86b4 100644 --- a/src/BootstrapBlazor.Shared/Pages/Install_wasm.razor +++ b/src/BootstrapBlazor.Shared/Pages/Install_wasm.razor @@ -1,6 +1,6 @@ @page "/install-wasm" - +
public class Program
 {
     public static async Task Main(string[] args)
diff --git a/src/BootstrapBlazor.Shared/Pages/Toasts.razor b/src/BootstrapBlazor.Shared/Pages/Toasts.razor
index 4d854144f..0bf819619 100644
--- a/src/BootstrapBlazor.Shared/Pages/Toasts.razor
+++ b/src/BootstrapBlazor.Shared/Pages/Toasts.razor
@@ -99,6 +99,29 @@
 
 
<Toast />
+特别说明: 可以通过 BootstrapBlazorOptions 全局统一配置参数可以设置整个系统内的 Toast 组件 Delay 参数值 + +

通过配置文件 appsetting.json 文件配置,适用于 Server-Side App

+ +
"BootstrapBlazorOptions": {
+    "ToastDelay": 4000,
+    "MessageDelay": 4000,
+    "SwalDelay": 4000
+}
+
+ +

通过 Startup 文件中的 ConfigureServices 方法配置,适用于 Server-Side AppWebAssembly App

+ +
public void ConfigureServices(IServiceCollection services)
+{
+    // 统一设置 Toast 组件自动消失时间
+    services.Configure<BootstrapBlazorOptions>(options =>
+    {
+        options.ToastDelay = 4000;
+    });
+}
+
+ diff --git a/src/BootstrapBlazor.WebAssembly.ClientHost/Program.cs b/src/BootstrapBlazor.WebAssembly.ClientHost/Program.cs index a52f8c3db..aac66fa8a 100644 --- a/src/BootstrapBlazor.WebAssembly.ClientHost/Program.cs +++ b/src/BootstrapBlazor.WebAssembly.ClientHost/Program.cs @@ -1,4 +1,5 @@ -using BootstrapBlazor.Shared; +using BootstrapBlazor.Components; +using BootstrapBlazor.Shared; using BootstrapBlazor.Shared.Data; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.Extensions.DependencyInjection; @@ -46,6 +47,8 @@ namespace BootstrapBlazor.WebAssembly.ClientHost builder.Services.AddSingleton(); + builder.Services.Configure(op => op.ToastDelay = 4000); + var host = builder.Build(); await GetCultureAsync(host);