搜索框 (SearchBox)

带搜索按钮的输入组件。

概述

  • 搜索框组件

代码演示

1.默认示例

namespace WebSite.Docus.Inputs.SearchBoxs;

class SearchBox1 : BaseComponent
{
    private string? message;

    protected override void BuildRenderTree(RenderTreeBuilder builder)
    {
        builder.Component<SearchBox>()
               .Set(c => c.Required, true)
               .Set(c => c.Placeholder, "请输入关键字")
               .Set(c => c.OnSearh, OnSearh)
               .Build();
        builder.Div("tips", message);
    }

    private void OnSearh(string key)
    {
        message = key;
        StateChanged();
    }
}