这是我正在使用的文本字段。
<MudTextField @bind-Value="Number" Label="Outlined" Variant="Variant.Outlined"></MudTextField>
Mud 是一个包含可在 Blazor 中使用的组件的库。这是文本字段文档:https://mudblazor.com/components/textfield#counter
这是我的使用和导入:
@using System.Security.Claims
@using global::Serilog
@using Signumid.ESignLiteShop.Data
@using Signumid.ESignLiteShop.Data.Models
@using Signumid.ESignLiteShop.Data.Services
@using Microsoft.AspNetCore.Http
@inject IHttpContextAccessor _httpContextAccessor
@inject ShopService _shopService
@inject IJSRuntime JSRuntime;
@inject NavigationManager _navManager
@using MudBlazor
我收到以下错误:
Home.razor(148, 40): [RZ9991] The attribute names could not be inferred from bind attribute 'bind-Value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
这可能是什么问题?
假设
Number
是 int
,试试这个:
<MudTextField
T="int"
@bind-Value="Number"
Label="Outlined"
Variant="Variant.Outlined"/>
我只需在标签名称前面添加 T="string" 即可解决此错误,如下所示:
<MudList T="string" Clickable="true">
希望有帮助