简体   繁体   English

在 blazor 应用程序中使用 MudTextField 会返回错误:“无法从绑定属性 'bind-Value' 推断属性名称。”

[英]Using MudTextField in a blazor app returns an error : 'The attribute names could not be inferred from bind attribute 'bind-Value'.'

This is the text field I am using.这是我正在使用的文本字段。

<MudTextField @bind-Value="Number" Label="Outlined" Variant="Variant.Outlined"></MudTextField>

Mud is a library with components to use in Blazor. Mud 是一个包含要在 Blazor 中使用的组件的库。 Here is text-field docs: https://mudblazor.com/components/textfield#counter这是文本字段文档: https ://mudblazor.com/components/textfield#counter

Here are my usings and imports:这是我的使用和导入:

@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

I am getting the following error: 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.我收到以下错误: 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. 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.

What could be the problem here?这里可能是什么问题?

Assuming Number is an int , try this:假设Number是一个int ,试试这个:

<MudTextField
  T="int"
  @bind-Value="Number"
  Label="Outlined" 
  Variant="Variant.Outlined"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM