How to make an EditForm Input that binds using oninput rather than onchange

后端 未结 4 2111
名媛妹妹
名媛妹妹 2020-12-19 20:58

Suppose I want to use an EditForm, but I want the value binding to trigger every time the user types into the control instead of just on blur. Suppose, for the sake of an ex

4条回答
  •  生来不讨喜
    2020-12-19 21:07

    Try this:

     
    

    More...

    Your approach is not recommended. You should subclass your components using Razor.

    The following is a sample that should work. It can redirects you how to get a solution.

    A solution to wrap an InputText:

    NewInputText.razor

    @functions{ [Parameter] string Label { get; set; } [Parameter] string Value { get; set; } [Parameter] EventCallback ValueChanged { get; set; } [Parameter] Expression> ValueExpression { get; set; } }

    Index.razor

    Name of the category: @category.Name
    
        
    
    

    You may also inherit from InputBase directly like so:

     @inherits InputBase
     
    

    Hope this helps...

提交回复
热议问题