fix(module: tabs): TabTemplate can't display in the overflow dropdown (#2320)

This commit is contained in:
James Yeung 2022-03-03 23:09:52 +08:00 committed by GitHub
parent ea55028218
commit 15f36f2a3c
5 changed files with 42 additions and 21 deletions

View File

@ -33,7 +33,16 @@
@foreach (var pane in _invisibleTabs) @foreach (var pane in _invisibleTabs)
{ {
<li class="ant-tabs-dropdown-menu-item @(pane.Disabled?$"ant-tabs-dropdown-menu-item-disabled":string.Empty)" id="@($"rc-tabs-{Id}-more-popup-{pane.Key}")" role="option" aria-disabled="false" aria-selected="false" aria-controls="@($"rc-tabs-{Id}-more-popup-{pane.Key}")" <li class="ant-tabs-dropdown-menu-item @(pane.Disabled?$"ant-tabs-dropdown-menu-item-disabled":string.Empty)" id="@($"rc-tabs-{Id}-more-popup-{pane.Key}")" role="option" aria-disabled="false" aria-selected="false" aria-controls="@($"rc-tabs-{Id}-more-popup-{pane.Key}")"
@onclick="(e)=>HandleTabClick(pane)">@pane.Tab</li> @onclick="(e)=>HandleTabClick(pane)">
@if (pane.TabTemplate != null)
{
@pane.TabTemplate
}
else
{
@pane.Tab
}
</li>
} }
</ul> </ul>
</Overlay> </Overlay>

View File

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.9" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.9" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="5.0.9" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" /> <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" /> <PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,23 +1,35 @@
@page "/counter/{id}" @page "/counter/{Id:int}"
@inherits ComponentBase @inherits ComponentBase
@implements IReuseTabsPage @implements IReuseTabsPage
<h1>Counter @Id</h1>
<p>Current count: @currentCount</p> <p>Current count: @currentCount</p>
<Button Type="primary" @onclick="IncrementCount">Click me</Button> <Button Type="primary" @onclick="IncrementCount">Click me</Button>
@code { <br />
<p @onclick="@(()=>GoTo($"/counter/{Id+1}"))">Go to @($"Counter {Id+1}")</p>
[Parameter] public string Id { get; set; }
@code {
[Parameter] public int Id { get; set; }
[Inject] private NavigationManager Navigation { get; set; }
private int currentCount = 0; private int currentCount = 0;
public RenderFragment GetPageTitle() =>@<span>@($"Counter {Id}")</span>; public RenderFragment GetPageTitle() =>
@<span>@($"Counter {Id}")</span>
;
private void IncrementCount() private void IncrementCount()
{ {
currentCount++; currentCount++;
} }
private void GoTo(string url)
{
Navigation.NavigateTo(url);
}
} }

View File

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<UserSecretsId>AntDesign.Tests.Authentication.Server-60788253-21B9-4F6A-87BD-B31690EE5806</UserSecretsId> <UserSecretsId>AntDesign.Tests.Authentication.Server-60788253-21B9-4F6A-87BD-B31690EE5806</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="5.0.9" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -14,12 +14,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.9" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.9" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.9" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" Version="5.0.9" /> <PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,5 @@
using AntDesign.TestApp.Server.Models; using AntDesign.TestApp.Server.Models;
using IdentityServer4.EntityFramework.Options; using Duende.IdentityServer.EntityFramework.Options;
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;