diff --git a/src/BootstrapBlazor.Shared/Locales/en.json b/src/BootstrapBlazor.Shared/Locales/en.json index 6a4274f798715576d073e30b5530e4c41ba4df30..917651b6d5bb98a74f61537d1459ff707f26a772 100644 --- a/src/BootstrapBlazor.Shared/Locales/en.json +++ b/src/BootstrapBlazor.Shared/Locales/en.json @@ -2205,6 +2205,8 @@ "FadeIntro": "By setting the IsFade property, the picture switches with a fade-in and fade-out effect", "CaptionTitle": "Caption", "CaptionIntro": "Set CarouselItem parameter Caption for the content of caption", + "IntervalTitle": "Individual interval", + "IntervalIntro": "Set Interval to a CarouselItem to change the amount of time to delay between automatically cycling to the next item. the default value is 5000 ms", "CaptionTemplateTitle": "Caption Template", "CaptionTemplateIntro": "Set CarouselItemCaptionTemplate custom the caption of item", "CaptionClassTitle": "Caption Class", diff --git a/src/BootstrapBlazor.Shared/Locales/zh.json b/src/BootstrapBlazor.Shared/Locales/zh.json index 73eb67b7cdad54a17d496211f1eca37854ba290f..03c5aebd42f5b66751161b7ba9683f0cfaf7a40a 100644 --- a/src/BootstrapBlazor.Shared/Locales/zh.json +++ b/src/BootstrapBlazor.Shared/Locales/zh.json @@ -2210,6 +2210,8 @@ "FadeIntro": "通过设置 IsFade 属性,图片切换时采用淡入淡出效果", "CaptionTitle": "标题", "CaptionIntro": "通过设置 CarouselItemCaption 属性,开启标题功能", + "IntervalTitle": "切换间隔", + "IntervalIntro": "通过设置 CarouselItemInterval 属性,可以单独设置幻灯片单独切换时间间隔,间隔默认值 5000 毫秒", "CaptionTemplateTitle": "标题模板", "CaptionTemplateIntro": "通过设置 CarouselItemCaptionTemplate 属性,自定义标题内容", "CaptionClassTitle": "标题样式", diff --git a/src/BootstrapBlazor.Shared/Samples/Carousels.razor b/src/BootstrapBlazor.Shared/Samples/Carousels.razor index e2f8f160550a042f4b69cbf3a9c70ef7aadfa90a..fe683fa66ba64dcf4c66e156766de3ad34ce3662 100644 --- a/src/BootstrapBlazor.Shared/Samples/Carousels.razor +++ b/src/BootstrapBlazor.Shared/Samples/Carousels.razor @@ -35,6 +35,20 @@ + + + + + + + + + + + + + + diff --git a/src/BootstrapBlazor/Components/Carousel/Carousel.razor b/src/BootstrapBlazor/Components/Carousel/Carousel.razor index 700417ecdafb620e4f0d914cddf6dff6867378c9..479d2ee072753bfe5f268c9671a45326040d1171 100644 --- a/src/BootstrapBlazor/Components/Carousel/Carousel.razor +++ b/src/BootstrapBlazor/Components/Carousel/Carousel.razor @@ -19,7 +19,7 @@ @for (var index = 0; index < Items.Count; index++) { var item = Items[index]; -
+
@item.ChildContent @if (item.ShowCaption) { diff --git a/src/BootstrapBlazor/Components/Carousel/CarouselItem.cs b/src/BootstrapBlazor/Components/Carousel/CarouselItem.cs index f508cf9d8faf740f04c92b8348aacbdbf8a8b9a7..5fd5b8779a2df347f3f77fd5305a4f3d44802a93 100644 --- a/src/BootstrapBlazor/Components/Carousel/CarouselItem.cs +++ b/src/BootstrapBlazor/Components/Carousel/CarouselItem.cs @@ -33,9 +33,20 @@ public class CarouselItem : ComponentBase, IDisposable [Parameter] public RenderFragment? CaptionTemplate { get; set; } + /// + /// 获得/设置 Slider 切换时间间隔 默认 5000 + /// + [Parameter] + public int Interval { get; set; } = 5000; + [CascadingParameter] private Carousel? Carousel { get; set; } + /// + /// 获得 Interval 字符串 + /// + internal string? IntervalString => Interval == 5000 ? null : Interval.ToString(); + /// /// OnInitialized 方法 ///