走马灯 (Carousel)

用于轮流播放一组图片。

概述

  • 用于轮流播放一组图片
  • 图片切换默认间隔3秒

代码演示

1.默认示例

namespace WebSite.Docus.View.Carousels;

class Carousel1 : BaseComponent
{
    private readonly string[] images = new string[]
    {
        "/img/demo/sunbin.jpg",
        "/img/demo/zhuangzhou.jpg",
        "/img/demo/jialuo.jpg"
    };

    protected override void BuildRenderTree(RenderTreeBuilder builder)
    {
        builder.Div("demo-carousel", attr =>
        {
            builder.Component<Carousel>()
                   .Set(c => c.Interval, 3000)
                   .Set(c => c.ShowSnk, true)
                   .Set(c => c.Images, images)
                   .Build();
        });
    }
}