相关疑难解决方法(0)

使 MudBlazor 表格的一行可点击?

我用 MudBlazor 制作了这张桌子:

<MudTable ServerData="@(new Func<TableState, Task<TableData<DossierInfo>>>(GetServerData))"
      RowsPerPage="@_PageSize"
      Dense="true"
      Hover="true"
      Bordered="false"
      Striped="true"
      Outlined="true"
      Filter="new Func<DossierInfo,bool>(FilterFunc)" Elevation="0">
<ToolBarContent>
    <MudTextField @bind-Value="searchString" Label="Ricerca" Placeholder="Digitare il testo da ricercare" Variant="Variant.Filled" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" />
    <!--<MudTextField @bind-Value="searchString" Placeholder="Search" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium"></MudTextField>-->
</ToolBarContent>
<HeaderContent>
    <MudTh>Tipo</MudTh>
    <MudTh>Nr</MudTh>
    <MudTh>Targa</MudTh>
    <MudTh>Tipo veicolo</MudTh>
    <MudTh>Marca</MudTh>
    <MudTh>Modello</MudTh>
    <MudTh>Km</MudTh>
    <MudTh>Totale validato</MudTh>
    <MudTh>Data apertura OL</MudTh>
    <MudTh></MudTh>
</HeaderContent>

<RowTemplate>
    <MudTd DataLabel="Tipo pratica"><MudIcon Icon="@DossierTypeIconService.GetDossierTypeIcon(context.Type)"></MudIcon></MudTd>
    <MudTd DataLabel="Numero">@context.Number</MudTd>
    <MudTd DataLabel="Targa">@context.VehiclePlate</MudTd>
    <MudTd DataLabel="Tipo veicolo">@context.VehicleType</MudTd>
    <MudTd DataLabel="Marca">@context.VehicleMake</MudTd>
    <MudTd DataLabel="Modello">@context.VehicleModel</MudTd>
    <MudTd DataLabel="Km">@context.VehicleKm</MudTd>
    <MudTd DataLabel="Totale validato">@context.ValidatedTotalAmount</MudTd>
    <MudTd DataLabel="Data apertura OL">@context.OpenedDate</MudTd>
    <MudTd DataLabel="Azioni" Style="text-align:right"> …
Run Code Online (Sandbox Code Playgroud)

blazor mudblazor

7
推荐指数
1
解决办法
1万
查看次数

Blazor 中的 @ondblclick 事件还会触发 2 个单击事件

在 Blazor WebAssembly 中考虑以下事项:

<span @onclick="Click" @ondblclick="DoubleClick">Click Me!</span>

@code {

    private void Click()
    {
        Console.WriteLine("Click");
    }

    private void DoubleClick()
    {
        Console.WriteLine("Double-click");
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我双击该元素,我将在控制台中看到的是:

Click
Click
Double-click
Run Code Online (Sandbox Code Playgroud)

有没有办法接收双击事件而不触发 2 个单击事件?我想将这两个事件用于不同的目的,因此它们相互干扰。

任何建议都非常感激。

asp.net-core blazor-client-side blazor-webassembly

2
推荐指数
1
解决办法
5415
查看次数